code
stringlengths
73
34.1k
label
stringclasses
1 value
public static void initialiseAcceptListenerFactory(AcceptListenerFactory _acceptListenerFactory) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initialiseAcceptListenerFactory", _acceptListenerFactory); Class clientImpl = instance.getClass(); Method initialiseAcceptListenerFactoryMethod; try { initialiseAcceptListenerFactoryMethod = clientImpl.getMethod("initialiseAcceptListenerFactory", new Class[] { AcceptListenerFactory.class }); initialiseAcceptListenerFactoryMethod.invoke(clientImpl, new Object[] { _acceptListenerFactory }); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.ServerConnectionManager.initialiseAcceptListenerFactory", JFapChannelConstants.SRVRCONNMGR_INITIALISE_ALF_01); //Make sure we allow for the fact this could be an InvocationTargetException Throwable displayedException = e; if (e instanceof InvocationTargetException) displayedException = e.getCause(); SibTr.error(tc, "EXCP_DURING_INIT_SICJ0081", new Object[] { clientImpl, displayedException }); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initialiseAcceptListenerFactory"); }
java
private void setCredential(Subject subject, WSPrincipal principal) throws CredentialException { String securityName = principal.getName(); Hashtable<String, ?> customProperties = getUniqueIdHashtableFromSubject(subject); if (customProperties == null || customProperties.isEmpty()) { UserRegistryService urService = userRegistryServiceRef.getService(); if (urService != null) { String urType = urService.getUserRegistryType(); if ("WIM".equalsIgnoreCase(urType) || "LDAP".equalsIgnoreCase(urType)) { try { securityName = urService.getUserRegistry().getUserDisplayName(securityName); } catch (Exception e) { //do nothing } } } } if (securityName == null || securityName.length() == 0) { securityName = principal.getName(); } String accessId = principal.getAccessId(); String customRealm = null; String realm = null; String uniqueName = null; if (customProperties != null) { customRealm = (String) customProperties.get(AttributeNameConstants.WSCREDENTIAL_REALM); } if (customRealm != null) { realm = customRealm; String[] parts = accessId.split(realm + "/"); if (parts != null && parts.length == 2) uniqueName = parts[1]; } else { realm = AccessIdUtil.getRealm(accessId); uniqueName = AccessIdUtil.getUniqueId(accessId); } if (AccessIdUtil.isServerAccessId(accessId)) { // Create a server WSCredential setCredential(null, subject, realm, securityName, uniqueName, null, accessId, null, null); } else { CredentialsService cs = credentialsServiceRef.getService(); String unauthenticatedUserid = cs.getUnauthenticatedUserid(); if (securityName != null && unauthenticatedUserid != null && securityName.equals(unauthenticatedUserid)) { // Create an unauthenticated WSCredential setCredential(unauthenticatedUserid, subject, realm, securityName, uniqueName, null, null, null, null); } else if (AccessIdUtil.isUserAccessId(accessId)) { // Create a user WSCredential createUserWSCredential(subject, securityName, accessId, realm, uniqueName, unauthenticatedUserid); } } }
java
private List<String> getUniqueGroupAccessIds(UserRegistry userRegistry, String realm, String uniqueName) throws EntryNotFoundException, RegistryException { List<String> uniqueGroupAccessIds = new ArrayList<String>(); List<String> uniqueGroupIds = userRegistry.getUniqueGroupIdsForUser(uniqueName); Iterator<String> groupIter = uniqueGroupIds.iterator(); while (groupIter.hasNext()) { String groupAccessId = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_GROUP, realm, groupIter.next()); uniqueGroupAccessIds.add(groupAccessId); } return uniqueGroupAccessIds; }
java
private String getPrimaryGroupId(List<String> uniqueGroupIds) { return uniqueGroupIds.isEmpty() ? null : uniqueGroupIds.get(0); }
java
@Override @FFDCIgnore({ CredentialDestroyedException.class, CredentialExpiredException.class }) public boolean isSubjectValid(Subject subject) { boolean valid = false; try { WSCredential wsCredential = getWSCredential(subject); if (wsCredential != null) { long credentialExpirationInMillis = wsCredential.getExpiration(); Date currentTime = new Date(); Date expirationTime = new Date(credentialExpirationInMillis); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Current time = " + currentTime + ", expiration time = " + expirationTime); } if (credentialExpirationInMillis == 0 || credentialExpirationInMillis == -1 || currentTime.before(expirationTime)) { valid = true; } } } catch (CredentialDestroyedException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "CredentialDestroyedException while determining the validity of the subject.", e); } } catch (CredentialExpiredException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "CredentialExpiredException while determining the validity of the subject.", e); } } return valid; }
java
private SibRaConnection createConnection( ConnectionRequestInfo requestInfo) throws SIResourceException, SINotPossibleInCurrentConfigurationException, SIIncorrectCallException, SIAuthenticationException { if (TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "createConnection", requestInfo); } SibRaConnection result = null; boolean tryAgain = true; do { try { // Obtain connection via connection manager final Object connection = _connectionManager.allocateConnection( _managedConnectionFactory, requestInfo); // Check it is one of ours if (connection instanceof SibRaConnection) { result = (SibRaConnection) connection; SibRaManagedConnection managedConnection = result.getManagedConnection(); // Pass a reference to this connection factory as the // connection needs access to the connection manager and // managed connection factory to perform lazy enlistment and // association result.setConnectionFactory(this); tryAgain = result.isCoreConnectionInValid(); if (tryAgain) { SibTr.info(TRACE, NLS.getString("CONNECTION_ERROR_RETRY_CWSIV0356"), new Object[] {result.getManagedConnection().getConnectionException()}); // We need to try again so we clone and change the cri (incremenet counter) which // forces j2c to create a new managed connection. Cloning is needed to prevent // a broken connection in the shared pool being returned because it has a // cri == this cri (PM31826) requestInfo = (ConnectionRequestInfo)((SibRaConnectionRequestInfo)requestInfo).clone(); ((SibRaConnectionRequestInfo)requestInfo).incrementRequestCounter(); // PK60857 the connection is broken so notify JCA to ensure it is cleaned up managedConnection.connectionErrorOccurred(new SIResourceException(), true); } } else { final ResourceException exception = new ResourceAdapterInternalException( NLS.getFormattedMessage( "INCORRECT_CONNECTION_TYPE_CWSIV0101", new Object[] { connection, SibRaConnection.class }, null)); if (TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } throw exception; } } catch (ResourceException exception) { FFDCFilter .processException( exception, "com.ibm.ws.sib.ra.impl.SibRaConnectionFactory.createConnection", "1:318:1.21", this); if (TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } if (exception.getCause() instanceof SIResourceException) { // If the original exception came from the underlying core SPI // throw this back to the caller... throw (SIResourceException) exception.getCause(); } else if (exception.getCause() instanceof SIErrorException) { // If the original exception came from the underlying core SPI // throw this back to the caller... throw (SIErrorException) exception.getCause(); } else if (exception.getCause() instanceof SINotPossibleInCurrentConfigurationException) { // If the original exception came from the underlying core SPI // throw this back to the caller... throw (SINotPossibleInCurrentConfigurationException) exception .getCause(); } else if (exception.getCause() instanceof SIIncorrectCallException) { // If the original exception came from the underlying core SPI // throw this back to the caller... throw (SIIncorrectCallException) exception.getCause(); } else if (exception.getCause() instanceof SIAuthenticationException) { // If the original exception came from the underlying core SPI // throw this back to the caller... throw (SIAuthenticationException) exception.getCause(); } else { // ...otherwise, wrap it in an SIResourceException throw new SIResourceException(NLS .getString("CONNECTION_FACTORY_EXCEPTION_CWSIV0050"), exception); } } } while (tryAgain); if (TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "createConnection", result); } return result; }
java
public void storeRecord(RepositoryLogRecord record) { if (isClosed) { throw new IllegalStateException("This instance of the exporter is already closed"); } if (!isInitialized) { throw new IllegalStateException("This instance of the exporter does not have header information yet"); } String formatRecord = formatter.formatRecord(record); out.print(formatRecord); out.print(formatter.getLineSeparator()); }
java
protected boolean acceptAnnotationsFrom(String className, boolean acceptPartial, boolean acceptExcluded) { String methodName = "acceptAnnotationsFrom"; // Don't unnecessarily obtain the annotation targets table: // No seed annotations will be obtained when the module is metadata-complete. if (config.isMetadataComplete()) { if (!acceptPartial && !acceptExcluded) { return false; } } try { WebAnnotations webAppAnnotations = getModuleContainer().adapt(WebAnnotations.class); AnnotationTargets_Targets table = webAppAnnotations.getAnnotationTargets(); return ( table.isSeedClassName(className) || (acceptPartial && table.isPartialClassName(className)) || (acceptExcluded && table.isExcludedClassName(className)) ); } catch (UnableToAdaptException e) { logger.logp(Level.FINE, CLASS_NAME, methodName, "caught UnableToAdaptException: " + e); return false; } }
java
protected void createSessionContext(DeployedModule moduleConfig) throws Throwable { try { // added sessionIdListeners for Servlet 3.1 ArrayList sessionRelatedListeners[] = new ArrayList[] { sessionListeners, sessionAttrListeners, sessionIdListeners }; // cmd // PQ81253 this.sessionCtx = ((WebGroup) parent).getSessionContext(moduleConfig, this, sessionRelatedListeners); // cmd // PQ81253 } catch (Throwable th) { // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "createSessionContext", "error.obtaining.session.context", th); throw new WebAppNotLoadedException(th.getMessage()); } }
java
protected void initializeTargetMappings() throws Exception { // NOTE: namespace preinvoke/postinvoke not necessary as the only // external // code being run is the servlet's init() and that is handled in the // ServletWrapper // check if an extensionFactory is present for *.jsp: // We do this by constructing an arbitrary mapping which // will only match the *.xxx extension pattern // if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) logger.entering(CLASS_NAME, "initializeTargetMappings"); initializeStaticFileHandler(); initializeInvokerProcessor(); if (config.isDirectoryBrowsingEnabled()) { try { IServletWrapper dirServlet = getServletWrapper("DirectoryBrowsingServlet"); requestMapper.addMapping(DIR_BROWSING_MAPPING, dirServlet); } catch (WebContainerException wce) { // pk435011 logger.logp(Level.WARNING, CLASS_NAME, "initializeTargetMappings", "mapping.for.directorybrowsingservlet.already.exists"); } catch (Exception exc) { // pk435011 logger.logp(Level.WARNING, CLASS_NAME, "initializeTargetMappings", "mapping.for.directorybrowsingservlet.already.exists"); } } }
java
private void initializeNonDDRepresentableAnnotation(IServletConfig servletConfig) { if (com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping()) return; String methodName = "initializeNonDDRepresentableAnnotation"; String configClassName = servletConfig.getClassName(); if (configClassName == null) { return; // Strange; but impossible to process; ignore. } if (!acceptAnnotationsFrom(configClassName, DO_NOT_ACCEPT_PARTIAL, DO_NOT_ACCEPT_EXCLUDED)) { return; // Ignore: In a metadata-complete or excluded region. } // Process: In a non-metadata-complete, non-excluded region. Class<?> configClass; try { configClass = Class.forName(configClassName, false, this.getClassLoader()); } catch (ClassNotFoundException e) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { LoggingUtil.logParamsAndException(logger, Level.FINE, CLASS_NAME, methodName, "unable to load class [{0}] which is benign if the class is never used", new Object[] { configClassName }, e); } return; } catch (NoClassDefFoundError e) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { LoggingUtil.logParamsAndException(logger, Level.FINE, CLASS_NAME, methodName, "unable to load class [{0}] which is benign if the class is never used", new Object[] { configClassName }, e); } return; } checkForServletSecurityAnnotation(configClass, servletConfig); }
java
@FFDCIgnore(Exception.class) protected void addStaticFilePatternMappings(RequestProcessor proxyReqProcessor) { String nextPattern; ExtensionProcessor fileExtensionProcessor = getDefaultExtensionProcessor(this, getConfiguration().getFileServingAttributes()); List patternList = fileExtensionProcessor.getPatternList(); Iterator patternIter = patternList.iterator(); int globalPatternsCount = 0; while (patternIter.hasNext()) { nextPattern = (String) patternIter.next(); // PK18713 try { if (proxyReqProcessor == null) requestMapper.addMapping(nextPattern, fileExtensionProcessor); // PK18713 else requestMapper.addMapping(nextPattern, proxyReqProcessor); } catch (Exception e) { // Mapping clash. Log error // pk435011 // LIBERTY: Fix for RTC defect 49695 -- The logging level should match the severity of the message. if (!!!"/*".equals(nextPattern)) { logger.logp(Level.SEVERE, CLASS_NAME, "initializeStaticFileHandler", "error.adding.servlet.mapping.file.handler", nextPattern); } else { globalPatternsCount++; } } } if (globalPatternsCount > 1) { logger.logp(Level.SEVERE, CLASS_NAME, "initializeStaticFileHandler", "error.adding.servlet.mapping.file.handler", "/*"); } }
java
public IServletWrapper getServletWrapper(String servletName, boolean addMapping) throws Exception // PK61140 { IServletWrapper targetWrapper = null; IServletConfig sconfig = config.getServletInfo(servletName); if (sconfig != null) { IServletWrapper existingServletWrapper = sconfig.getServletWrapper(); if (existingServletWrapper != null) return existingServletWrapper; } // Retrieve the list of mappings associated with 'servletName' List<String> mappings = config.getServletMappings(servletName); if (mappings != null) { for (String mapping : mappings) { if (mapping.length() > 0 && mapping.charAt(0) != '/' && mapping.charAt(0) != '*') mapping = '/' + mapping; RequestProcessor p = requestMapper.map(mapping); if (p != null) { if (p instanceof IServletWrapper) { if (((IServletWrapper) p).getServletName().equals(servletName)) { targetWrapper = (IServletWrapper) p; break; } } } } } if (targetWrapper != null) return targetWrapper; // Begin 650884 // PK61140 - Starts // String path = BY_NAME_ONLY + servletName; // RequestProcessor p = requestMapper.map(path); // // RequestProcessor p = requestMapper.map(BY_NAME_ONLY + servletName); // // // PK61140 - Ends // // // if (p != null) // if (p instanceof ServletWrapper) { // if (((ServletWrapper) p).getServletName().equals(servletName)) // targetWrapper = (ServletWrapper) p; // } // // if (targetWrapper != null) // return targetWrapper; // End 650884 if (sconfig == null) { int internalIndex; if ((internalIndex = getInternalServletIndex(servletName)) >= 0) { sconfig = loadInternalConfig(servletName, internalIndex); } else { // Not found in DD, and not an Internal Servlet, stray?? // return null; } } // return webExtensionProcessor.createServletWrapper(sconfig); // // PK61140 // PK61140 - Starts IServletWrapper sw = webExtensionProcessor.createServletWrapper(sconfig); // Begin 650884 // if ((sw != null)) { // if (addMapping) { // synchronized (sconfig) { // if (!requestMapper.exists(path)) { // requestMapper.addMapping(path, sw); // } // } // } // } // End 650884 return sw; // PK61140 - Ends }
java
private ServletConfig loadInternalConfig(String servletName, int internalIndex) throws ServletException { ServletConfig sconfig = createConfig("InternalServlet_" + servletName, internalIndex); sconfig.setServletName(servletName); sconfig.setDisplayName(servletName); sconfig.setServletContext(this.getFacade()); sconfig.setIsJsp(false); sconfig.setClassName(internalServletList[internalIndex][1]); return sconfig; }
java
protected Object loadListener(String lClassName) throws InjectionException, Throwable //596191 :: PK97815 { Object listener = null; try { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) logger.logp(Level.FINE, CLASS_NAME, "loadListener", "loadListener Classloader " + getClassLoader()); // PK16542 end // instantiate the listener listener = java.beans.Beans.instantiate(getClassLoader(), lClassName); } catch (Throwable th) { // some exception, log error. logError("Failed to load listener: " + lClassName, th); if (WCCustomProperties.STOP_APP_STARTUP_ON_LISTENER_EXCEPTION) { //PI58875 throw th; } } return listener; }
java
public void addToStartWeightList(IServletConfig sc) { // we haven't started sorting the startup weights yet so just ignore. It // will be added later. if (this.sortedServletConfigs == null) return; int size = this.sortedServletConfigs.size(); int pos = 0; boolean added = false; if (size == 0 || !sc.isLoadOnStartup()) sortedServletConfigs.add(sc); else { // remove the current entry if it was already added if (sc.isAddedToLoadOnStartup() && sc.isWeightChanged()) sortedServletConfigs.remove(sc); int value = sc.getStartUpWeight(); for (IServletConfig curServletConfig : sortedServletConfigs) { int curStartupWeight = curServletConfig.getStartUpWeight(); if (value < curStartupWeight || !curServletConfig.isLoadOnStartup()) { sortedServletConfigs.add(pos, sc); added = true; break; } pos++; } if (!added) sortedServletConfigs.add(sc); } sc.setAddedToLoadOnStartup(true); }
java
public void notifyStart() { try { eventSource.onApplicationAvailableForService(new ApplicationEvent(this, this, new com.ibm.ws.webcontainer.util.IteratorEnumerator(config.getServletNames()))); // LIBERTY: next line added by V8 sync //this.setInitialized(true); } catch (Exception e) { com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, CLASS_NAME + ".started", "3220", this); // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "started", "error.on.collaborator.started.call"); } }
java
public void addMappingFilter(IServletConfig sConfig, IFilterConfig config) { IFilterMapping fmapping = new FilterMapping(null, config, sConfig); _addMapingFilter(config, fmapping); }
java
public void initialize() throws ServletException, Throwable { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) logger.entering(CLASS_NAME, "Initialize : app = " + config.getApplicationName() + ", initialized = " + initialized + ", destroyed = " + destroyed); if (!initialized && !destroyed) { synchronized (lock) { if (!initialized && !destroyed &&!com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping()) { initialize(this.config, this.moduleConfig, this.extensionFactories); started(); initialized = true; config.setSessionCookieConfigInitilialized(); } } } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) logger.exiting(CLASS_NAME, "Initialize : initialized = " + initialized + ", destroyed = " + destroyed); }
java
public void setModuleContainer(com.ibm.wsspi.adaptable.module.Container c){ container = c; metaInfResourceFinder = new MetaInfResourceFinder(container); }
java
private void addAllEntries(Set s, com.ibm.wsspi.adaptable.module.Container dir) throws UnableToAdaptException { for(Entry entry : dir){ String path = entry.getPath(); com.ibm.wsspi.adaptable.module.Container possibleContainer = entry.adapt(com.ibm.wsspi.adaptable.module.Container.class); //If this container appears to be a directory then we need to add / to the path //If this container is a nested archive, then we add it as-is. if(possibleContainer != null && !possibleContainer.isRoot()) { path = path + "/"; } s.add(path); } }
java
private void populateCache() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "populateCache", this); } try { HashMap<String, BaseDestination> destList = _bus.getLWMMEConfig().getMessagingEngine().getDestinationList(); Iterator<Entry<String, BaseDestination>> entries = destList.entrySet().iterator(); while (entries != null && entries.hasNext()) { Entry<String, BaseDestination> entry = entries.next(); BaseDestination bd = (BaseDestination) entry.getValue(); if(bd.isAlias()) { AliasDestination alias=(AliasDestination)bd; _rawDestinations.add(alias); BaseDestinationDefinition dd = ((JsAdminFactoryImpl) _jsaf).createDestinationAliasDefinition(alias); addEntry(_bus.getName(), dd, alias); } else { SIBDestination oo = (SIBDestination) entry.getValue(); _rawDestinations.add(oo); if (oo.getDestinationType() == DestinationType.QUEUE) { LWMConfig queue = oo; DestinationDefinition dd = ((JsAdminFactoryImpl) _jsaf).createDestinationDefinition(queue); addEntry(_bus.getName(), dd, queue); } else if (oo.getDestinationType() == DestinationType.TOPICSPACE) { LWMConfig topicspace = oo; DestinationDefinition dd = ((JsAdminFactoryImpl) _jsaf).createDestinationDefinition(topicspace); // Set auditAllowed. // Boolean auditAllowed = (Boolean) tsAuditMap.get(dd.getName()); // if (auditAllowed != null) { // ((DestinationDefinitionImpl) dd).setAuditAllowed(auditAllowed.booleanValue()); // } addEntry(_bus.getName(), dd, topicspace); } } } // ...end while... } catch (Exception e) { SibTr.error(tc, "POPULATE_DESTINATION_FAILED_SIAS0114" + e); e.printStackTrace(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "populateCache"); } }
java
@Activate protected void activate(BundleContext ctx, Map<String, Object> properties) { SibTr.entry(tc, CLASS_NAME + "activate", properties); this.properties = properties; this.bundleLocation = ctx.getBundle().getLocation(); populateDestinationPermissions(); runtimeSecurityService.modifyMessagingServices(this); SibTr.exit(tc, CLASS_NAME + "activate"); }
java
@Modified protected void modify(ComponentContext cc, Map<String, Object> properties) { SibTr.entry(tc, CLASS_NAME + "modify", properties); this.properties = properties; populateDestinationPermissions(); runtimeSecurityService.modifyMessagingServices(this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "modify"); } }
java
@Deactivate protected void deactivate(ComponentContext context) { SibTr.entry(tc, CLASS_NAME + "deactivate", context); runtimeSecurityService.modifyMessagingServices(null); queuePermissions = null; topicPermissions = null; temporaryDestinationPermissions = null; sibAuthenticationService = null; sibAuthorizationService = null; this.bundleLocation = null; SibTr.exit(tc, CLASS_NAME + "deactivate"); }
java
@Reference protected void setSecurityService(SecurityService securityService) { SibTr.entry(tc, CLASS_NAME + "setSecurityService", securityService); this.securityService = securityService; SibTr.exit(tc, CLASS_NAME + "setSecurityService"); }
java
protected void unsetSecurityService(SecurityService securityService) { SibTr.entry(tc, CLASS_NAME + "unsetSecurityService", securityService); SibTr.exit(tc, CLASS_NAME + "unsetSecurityService"); }
java
@Reference protected void setConfigAdmin(ConfigurationAdmin configAdmin) { SibTr.entry(tc, CLASS_NAME + "setConfigAdmin", configAdmin); this.configAdmin = configAdmin; SibTr.exit(tc, CLASS_NAME + "setConfigAdmin"); }
java
protected void unsetConfigAdmin(ConfigurationAdmin configAdmin) { SibTr.entry(tc, CLASS_NAME + "unsetConfigAdmin", configAdmin); SibTr.exit(tc, CLASS_NAME + "unsetConfigAdmin"); }
java
@Override public MessagingAuthenticationService getMessagingAuthenticationService() { SibTr.entry(tc, CLASS_NAME + "getMessagingAuthenticationService"); if (sibAuthenticationService == null) { sibAuthenticationService = new MessagingAuthenticationServiceImpl(this); } SibTr.exit(tc, CLASS_NAME + "getMessagingAuthenticationService", sibAuthenticationService); return sibAuthenticationService; }
java
@Override public MessagingAuthorizationService getMessagingAuthorizationService() { SibTr.entry(tc, CLASS_NAME + "getMessagingAuthorizationService"); if (sibAuthorizationService == null) { sibAuthorizationService = new MessagingAuthorizationServiceImpl(this); } SibTr.exit(tc, CLASS_NAME + "getMessagingAuthorizationService", sibAuthorizationService); return sibAuthorizationService; }
java
public UserRegistry getUserRegistry() { SibTr.entry(tc, CLASS_NAME + "getUserRegistry"); UserRegistry userRegistry = null; if (getSecurityService() != null) { UserRegistryService userRegistryService = securityService .getUserRegistryService(); try { if (userRegistryService.isUserRegistryConfigured()) { userRegistry = userRegistryService.getUserRegistry(); } else { MessagingSecurityException mse = new MessagingSecurityException(); FFDCFilter.processException(mse, CLASS_NAME + ".getUserRegistry", "1005", this); SibTr.exception(tc, mse); SibTr.error(tc, "USER_REGISTRY_NOT_CONFIGURED_MSE1005"); } } catch (RegistryException re) { MessagingSecurityException mse = new MessagingSecurityException(re); FFDCFilter.processException(mse, CLASS_NAME + ".getUserRegistry", "1006", this); SibTr.exception(tc, mse); SibTr.error(tc, "USER_REGISTRY_EXCEPTION_MSE1006"); } } SibTr.exit(tc, CLASS_NAME + "getUserRegistry", userRegistry); return userRegistry; }
java
private void populateDestinationPermissions() { SibTr.entry(tc, CLASS_NAME + "populateDestinationPermissions", properties); pids.clear(); String[] roles = (String[]) properties .get(MessagingSecurityConstants.ROLE); initializeMaps(); if (roles != null) { checkIfRolesAreUnique(roles); for (String role : roles) { Dictionary<String, Object> roleProperties = getDictionaryObject(role); Set<String> users = null; Set<String> groups = null; // Get the list of Users users = createUserOrGroupSet(roleProperties, MessagingSecurityConstants.USER); // Get the list of Groups groups = createUserOrGroupSet(roleProperties, MessagingSecurityConstants.GROUP); if (roleProperties != null) { populateQueuePermissions(roleProperties, users, groups); populateTemporarayDestinationPermissions(roleProperties, users, groups); populateTopicPermissions(roleProperties, users, groups); } } } if (tc.isDebugEnabled()) { SibTr.debug(tc, CLASS_NAME + " ***** Queue Permissions *****"); printDestinationPermissions(queuePermissions); SibTr.debug(tc, CLASS_NAME + " ***** Topic Permissions *****"); printDestinationPermissions(topicPermissions); SibTr.debug(tc, CLASS_NAME + " ***** Temporary DestinationPermissions *****"); printDestinationPermissions(temporaryDestinationPermissions); } SibTr.exit(tc, CLASS_NAME + "populateDestinationPermissions"); }
java
private Dictionary<String, Object> getDictionaryObject(String input) { SibTr.entry(tc, CLASS_NAME + "getDictionaryObject", input); Dictionary<String, Object> dictionary = null; Configuration config = null; try { pids.add(input); config = configAdmin.getConfiguration(input, bundleLocation); } catch (IOException e) { MessagingSecurityException mse = new MessagingSecurityException(e); FFDCFilter.processException(mse, CLASS_NAME + ".getDictionaryObject", "1008", this); SibTr.exception(tc, mse); SibTr.error(tc, "IO_EXCEPTION_READING_CONFIGURATION_MSE1008"); return new Hashtable<String, Object>(); } dictionary = config.getProperties(); SibTr.exit(tc, CLASS_NAME + "getDictionaryObject", dictionary); return dictionary; }
java
private void printDestinationPermissions(Map<String, ?> destinationPermissions) { Set<String> destinations = destinationPermissions.keySet(); for (String destination : destinations) { SibTr.debug(tc, CLASS_NAME + " Destination: " + destination); Permission permission = (Permission) destinationPermissions.get(destination); SibTr.debug(tc, " Users having permissions!!!"); Map<String, Set<String>> userRoles = permission.getRoleToUserMap(); Set<String> uRoles = userRoles.keySet(); for (String role : uRoles) { SibTr.debug(tc, " " + role + ": " + userRoles.get(role)); } SibTr.debug(tc, " Groups having permissions!!!"); Map<String, Set<String>> groupRoles = permission .getRoleToGroupMap(); Set<String> gRoles = groupRoles.keySet(); for (String role : gRoles) { SibTr.debug(tc, " " + role + ": " + groupRoles.get(role)); } } }
java
public static final RecoveryProcessor getInstance() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getInstance"); } if (_processor == null) { try { Class c = Class.forName("com.ibm.ws.sib.processor.impl.RecoveryProcessorImpl"); _processor = (RecoveryProcessor) c.newInstance(); } catch (Exception e) { e.printStackTrace(); } } if (tc.isEntryEnabled()) { SibTr.exit(tc, "getMBean", _processor); } return _processor; }
java
protected void init(int code, String phrase, boolean isError) { this.myPhrase = phrase; this.myPhraseBytes = HttpChannelUtils.getEnglishBytes(phrase); this.myIntCode = code; if (isError) { this.myError = new HttpError(code, this.myPhrase); } initSpecialArrays(); checkForAllowedBody(); }
java
public static StatusCodes makeUndefinedValue(int value) { StatusCodes code = new StatusCodes(StatusCodes.UNDEF); code.name = Integer.toString(value); code.byteArray = HttpChannelUtils.getEnglishBytes(code.getName()); code.myIntCode = value; code.initSpecialArrays(); code.checkForAllowedBody(); code.hashcode = code.ordinal + code.name.hashCode(); code.undefined = true; return code; }
java
protected void initSpecialArrays() { int len = getByteArray().length; // set up the "status code + SPACE + default reason phrase" this.bytesWithPhrase = new byte[len + 1 + this.myPhraseBytes.length]; System.arraycopy(getByteArray(), 0, this.bytesWithPhrase, 0, len); this.bytesWithPhrase[len] = BNFHeaders.SPACE; System.arraycopy(this.myPhraseBytes, 0, this.bytesWithPhrase, len + 1, this.myPhraseBytes.length); }
java
public static StatusCodes getByOrdinal(int i) { if (0 > i || i >= MAX_CODE) { throw new IndexOutOfBoundsException("Index " + i + " is out of bounds"); } return statusCodes[i]; }
java
public synchronized static void addBundleRepository(String installDir, String featureType) { BundleRepositoryHolder bundleRepositoryHolder = new BundleRepositoryHolder(installDir, cacheServerName, featureType); if (!repositoryHolders.containsKey(featureType)) repositoryHolders.put(featureType, bundleRepositoryHolder); }
java
public Object put(Object key, Object value) { if (null == key) throw new IllegalArgumentException("key must not be null"); if (!(key instanceof String)) throw new IllegalArgumentException("key must be a String"); if (!isValidObject(value)) { if (value != null) { throw new IllegalArgumentException("Invalid type of value. Type: [" + value.getClass().getName() + "] with value: [" + value.toString() + "]"); } else { throw new IllegalArgumentException("Invalid type of value."); } } /** * Only put it in the ordering list if it isn't already present. */ if (!this.containsKey(key)) { this.order.add(key); } return super.put(key, value); }
java
public Object remove(Object key) { Object retVal = null; if (null == key) throw new IllegalArgumentException("key must not be null"); if (this.containsKey(key)) { retVal = super.remove(key); for (int i = 0; i < this.order.size(); i++) { Object obj = this.order.get(i); if (obj.equals(key)) { this.order.remove(i); break; } } } return retVal; }
java
private static int getAvailableProcessorsFromFilesystem() { boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); Double availableProcessorsDouble = null; int availableProcessorsInt = -1; //Check for docker files String periodFileLocation = File.separator + "sys" + File.separator + "fs" + File.separator + "cgroup" + File.separator + "cpu" + File.separator + "cpu.cfs_period_us"; String quotaFileLocation = File.separator + "sys" + File.separator + "fs" + File.separator + "cgroup" + File.separator + "cpu" + File.separator + "cpu.cfs_quota_us"; File cfsPeriod = new File(periodFileLocation); File cfsQuota = new File(quotaFileLocation); if (cfsPeriod.exists() && cfsQuota.exists()) { //Found docker files //Read quota try { String quotaContents = readFile(cfsQuota); double quotaFloat = new Double(quotaContents); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "quotaFloat = " + quotaFloat); if (quotaFloat >= 0) { //Read period String periodContents = readFile(cfsPeriod); double periodFloat = new Double(periodContents); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "periodFloat = " + periodFloat); if (periodFloat != 0) { availableProcessorsDouble = quotaFloat / periodFloat; availableProcessorsDouble = roundToTwoDecimalPlaces(availableProcessorsDouble); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Calculated availableProcessors: " + availableProcessorsDouble + ". period=" + periodFloat + ", quota=" + quotaFloat); } } } catch (Throwable e) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Caught exception: " + e.getMessage() + ". Using number of processors reported by java"); availableProcessorsDouble = null; } } else { if (isTraceOn && tc.isDebugEnabled()) { Tr.debug(tc, "Files " + quotaFileLocation + " : " + cfsQuota.exists()); Tr.debug(tc, "Files " + periodFileLocation + " : " + cfsPeriod.exists()); } } availableProcessorsInt = (availableProcessorsDouble == null) ? -1 : availableProcessorsDouble.intValue(); // make sure any z.xy cpu quota was not rounded down (especially to 0 ...) during int conversion if (availableProcessorsDouble != null && availableProcessorsDouble > availableProcessorsInt) availableProcessorsInt++; return availableProcessorsInt; }
java
public static void processAllEntryProbeExtensions(Event event, RequestContext requestContext) { if (event == requestContext.getRootEvent()) { // Add the request to Active Request list requestContext.setRequestContextIndex(activeRequests.add(requestContext)); } List<ProbeExtension> probeExtnList = RequestProbeService.getProbeExtensions(); for (int i = 0; i < probeExtnList.size(); i ++) { ProbeExtension probeExtension = probeExtnList.get(i); try{ // Entry enabled?? if (probeExtension.invokeForEventEntry()) { // To be sampled ?? if (requestContext.getRequestId().getSequenceNumber() % probeExtension.getRequestSampleRate() == 0) { if (event == requestContext.getRootEvent() && probeExtension.invokeForRootEventsOnly() == true && (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) { probeExtension.processEntryEvent(event, requestContext); } if (probeExtension.invokeForRootEventsOnly() == false && (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) { probeExtension.processEntryEvent(event, requestContext); } } } }catch(Exception e){ if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){ Tr.debug(tc, "----------------Probe extension invocation failure---------------"); Tr.debug(tc, probeExtension.getClass().getName() + ".processEntryEvent failed because of the following reason:" ); Tr.debug(tc, e.getMessage()); } FFDCFilter.processException(e, RequestProbeService.class.getName() + ".processAllEntryProbeExtensions", "148"); } } }
java
public static void processAllExitProbeExtensions(Event event, RequestContext requestContext) { List<ProbeExtension> probeExtnList = RequestProbeService.getProbeExtensions(); for (int i = 0; i < probeExtnList.size(); i ++) { ProbeExtension probeExtension = probeExtnList.get(i); try{ // Exit enabled?? if (probeExtension.invokeForEventExit()) { // To be sampled ?? if (requestContext.getRequestId().getSequenceNumber() % probeExtension.getRequestSampleRate() == 0) { if (event == requestContext.getRootEvent() && probeExtension.invokeForRootEventsOnly() == true && (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) { probeExtension.processExitEvent(event, requestContext); } if (probeExtension.invokeForRootEventsOnly() == false && (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) { probeExtension.processExitEvent(event, requestContext); } } } }catch(Exception e){ if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){ Tr.debug(tc, "----------------Probe extension invocation failure---------------"); Tr.debug(tc, probeExtension.getClass().getName() + ".processExitEvent failed because of the following reason:" ); Tr.debug(tc, e.getMessage()); } FFDCFilter.processException(e, RequestProbeService.class.getName() + ".processAllExitProbeExtensions", "185"); } } if (event == requestContext.getRootEvent()) { // Remove the request from active request list try{ RequestContext storedRequestContext = activeRequests.get(requestContext.getRequestContextIndex()); // 1) Check to handle stale requests. // A long running stale request from the last time the feature was enabled could potentially // end up evicting a valid request that is occupying the same slot in the list. // 2) Also check if the returned request context is null, this can happen when we remove the feature while // a request is executing as we clean up the active requests list and the slot no longer holds a request context. if(storedRequestContext != null && (storedRequestContext.getRequestId() == requestContext.getRequestId())) activeRequests.remove(requestContext.getRequestContextIndex()); }catch(ArrayIndexOutOfBoundsException e){ //Do nothing as this can fail for an in-flight request when the feature is disabled //Rational being, the active request list gets reset and this index can no longer be valid. } } }
java
public static void processAllCounterProbeExtensions(Event event){ List<ProbeExtension> probeExtnList = RequestProbeService.getProbeExtensions(); for (int i = 0; i < probeExtnList.size(); i ++) { ProbeExtension probeExtension = probeExtnList.get(i); try{ //Check if this probe extension is interested in //counter events if(probeExtension.invokeForCounter()){ probeExtension.processCounter(event); } }catch(Exception e){ if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){ Tr.debug(tc, "----------------Probe extension invocation failure---------------"); Tr.debug(tc, probeExtension.getClass().getName() + ".processCounterEvent failed because of the following reason:" ); Tr.debug(tc, e.getMessage()); } FFDCFilter.processException(e, RequestProbeService.class.getName() + ".processAllCounterProbeExtensions", "215"); } } }
java
@Reference(name = KEY_SECURITY_SERVICE, policy = ReferencePolicy.DYNAMIC) protected void setSecurityService(SecurityService securitysvc) { securityService = securitysvc; }
java
public static String getUserName() throws Exception { Subject subject = getRunAsSubjectInternal(); if (subject == null) { return null; } Set<Principal> principals = subject.getPrincipals(); Iterator<Principal> principalsIterator = principals.iterator(); if (principalsIterator.hasNext()) { Principal principal = principalsIterator.next(); return principal.getName(); } return null; }
java
public static synchronized boolean pushSubject(String username) { if (securityService == null || username == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "returning false because user or securityService is null," + " user= " + username + " secsvc= " + securityService); } return false; } AuthenticationService authenticationService = securityService.getAuthenticationService(); Subject tempSubject = new Subject(); Hashtable<String, Object> hashtable = new Hashtable<String, Object>(); if (!authenticationService.isAllowHashTableLoginWithIdOnly()) { hashtable.put(AuthenticationConstants.INTERNAL_ASSERTION_KEY, Boolean.TRUE); } hashtable.put("com.ibm.wsspi.security.cred.userId", username); tempSubject.getPublicCredentials().add(hashtable); try { Subject new_subject = authenticationService.authenticate(JaasLoginConfigConstants.SYSTEM_WEB_INBOUND, tempSubject); return setRunAsSubject(new_subject); } catch (AuthenticationException e) { FFDCFilter.processException(e, TokenPropagationHelper.class.getName(), "pushSubject", new Object[] { username }); Tr.error(tc, "ERROR_AUTHENTICATE", new Object[] { e.getMessage() }); // CWWKS6103E return false; } catch (Exception e) { FFDCFilter.processException(e, TokenPropagationHelper.class.getName(), "pushSubject", new Object[] { username }); return false; } }
java
public static synchronized boolean setRunAsSubject(Subject subj) { Subject before = null; try { before = getRunAsSubject(); final Subject fsubj = subj; AccessController.doPrivileged( new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { WSSubject.setRunAsSubject(fsubj); return null; } }); } catch (PrivilegedActionException e) { FFDCFilter.processException(e, TokenPropagationHelper.class.getName(), "setRunAsSubject", new Object[] {}); return false; } if (tc.isDebugEnabled()) { Tr.debug(tc, "setRunAsSubject, runAsSubject before = ", before); Tr.debug(tc, "setRunAsSubject, runAsSubject after = ", subj); } return true; }
java
public static TopicWildcardTranslation getInstance() throws Exception { if (tcInt.isEntryEnabled()) Tr.entry(tcInt, "getInstance"); if (twt == null) { try { Class cls = Class.forName(UtConstants.TWT_FACTORY_CLASS); twt = (TopicWildcardTranslation) cls.newInstance(); } catch(InstantiationException ie) { // No FFDC code needed if (tcInt.isDebugEnabled())Tr.debug(tcInt, "Unable to instantiate TopicWildcardTranslation", ie); if (tcInt.isEntryEnabled())Tr.exit(tcInt, "getInstance"); twt = null; throw ie; } } if (tcInt.isEntryEnabled()) Tr.exit(tcInt, "getInstance"); return twt; }
java
public static VersionRange getFilterRange(FilterVersion minVersion, FilterVersion maxVersion) { VersionRange vr = null; Version vmin = minVersion == null ? Version.emptyVersion : new Version(minVersion.getValue()); Version vmax = maxVersion == null ? null : new Version(maxVersion.getValue()); char leftType = (minVersion == null || minVersion.getInclusive()) ? VersionRange.LEFT_CLOSED : VersionRange.LEFT_OPEN; char rightType = (maxVersion == null || maxVersion.getInclusive()) ? VersionRange.RIGHT_CLOSED : VersionRange.RIGHT_OPEN; vr = new VersionRange(leftType, vmin, vmax, rightType); return vr; }
java
public boolean update(File directory, String fileName, String fileExtension, int maxFiles) { this.maxFiles = maxFiles; boolean updateLocation = !directory.equals(this.directory) || !fileName.equals(this.fileName) || !fileExtension.equals(this.fileExtension); if (updateLocation) { this.directory = directory; this.fileName = fileName; this.fileExtension = fileExtension; filePattern = LoggingFileUtils.compileLogFileRegex(fileName, fileExtension); // The location was updated, so remove our list of cached files. files = null; } if (maxFiles <= 0) { files = null; } else { if (files == null) { files = new ArrayList<String>(); // Sort and add all existing files. String[] existing = LoggingFileUtils.safelyFindFiles(directory, filePattern); if (existing != null) { Arrays.sort(existing, NaturalComparator.instance); files.addAll(Arrays.asList(existing)); } } // Delete excess old files if necessary. int maxTrackedFiles = getMaxDateFiles(); while (files.size() > maxTrackedFiles) { removeFile(0); } // If the location was updated, initialize the counter from the // remaining files (if any). if (updateLocation) { if (files.isEmpty()) { lastDateString = null; } else { Matcher matcher = filePattern.matcher(files.get(files.size() - 1)); if (!matcher.matches()) throw new IllegalStateException(); lastDateString = matcher.group(1); lastCounter = Integer.parseInt(matcher.group(2)); } } } return updateLocation; }
java
private void addFile(int index, String file) { if (maxFiles > 0) { int numFiles = files.size(); int maxDateFiles = getMaxDateFiles(); // If there is no max or we have fewer than max, then we're done. if (maxDateFiles <= 0 || numFiles < maxDateFiles) { files.add(index, file); } else { // The file names we deal with (messages_xx.xx.xx_xx.xx.xx.log) // have dates, and we want to always be using the "most recent", // so delete everything "newer" (index and after), which might be // present if the system clock goes backwards, and then delete // the oldest files until only maxDateFiles-1 remain. while (files.size() > index) { removeFile(files.size() - 1); } while (files.size() >= maxDateFiles) { removeFile(0); } files.add(file); } } }
java
protected JsJmsMessage instantiateMessage() throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateMessage"); // Create a new message object. JsJmsMessage newMsg = jmfact.createJmsMessage(); messageClass = CLASS_NONE; // d317373 default the MSG_TYPE to be DATAGRAM until setReplyTo is called newMsg.setNonNullProperty(ApiJmsConstants.MSG_TYPE_PROPERTY, Integer.valueOf(ApiJmsConstants.MQMT_DATAGRAM)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateMessage", newMsg); return newMsg; }
java
protected JsJmsMessage getMsgReference() throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getMsgReference"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getMsgReference", msg); return msg; }
java
protected void setDestReference(Destination d) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDestReference", d); dest = d; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setDestReference"); }
java
protected void checkBodyWriteable(String callingMethodName) throws JMSException { if (bodyReadOnly) { throw (javax.jms.MessageNotWriteableException) JmsErrorUtils.newThrowable(javax.jms.MessageNotWriteableException.class, "READ_ONLY_MESSAGE_BODY_CWSIA0107", new Object[] { callingMethodName }, tc ); } }
java
protected void checkBodyReadable(String callingMethodName) throws MessageNotReadableException { if (!bodyReadOnly) { throw (javax.jms.MessageNotReadableException) JmsErrorUtils.newThrowable(javax.jms.MessageNotReadableException.class, "WRITE_ONLY_MESSAGE_BODY_CWSIA0109", new Object[] { callingMethodName }, tc ); } }
java
protected void checkPropertiesWriteable(String callingMethodName) throws JMSException { if (propertiesReadOnly) { throw (javax.jms.MessageNotWriteableException) JmsErrorUtils.newThrowable(javax.jms.MessageNotWriteableException.class, "READ_ONLY_MESSAGE_PROPERTY_CWSIA0108", new Object[] { callingMethodName }, tc ); } }
java
public Reliability getReliability() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getReliability"); Reliability r = msg.getReliability(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getReliablity", r); return r; }
java
protected void setBodyReadOnly() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setBodyReadOnly"); bodyReadOnly = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setBodyReadOnly"); }
java
void clearLocalProperties() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "clearLocalProperties"); if (locallyStoredPropertyValues != null) locallyStoredPropertyValues.clear(); // d255144 Also clear the local version of the messageID localJMSMessageID = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "clearLocalProperties"); }
java
void invalidateToStringCache() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "invalidateToStringCache"); // Invalidate the toString cache. cachedToString = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "invalidateToStringCache"); }
java
static void checkPropName(String name, String callingMethodName) throws IllegalArgumentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "checkPropName", new Object[] { name, callingMethodName }); if ((name == null) || ("".equals(name))) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Invalid field name: " + name + " as parameter to " + callingMethodName); throw (IllegalArgumentException) JmsErrorUtils.newThrowable(IllegalArgumentException.class, "INVALID_FIELD_NAME_CWSIA0106", null, // no inserts for CWSIA0106 tc ); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "checkPropName"); }
java
public String getDatabasePlatformClassName(PUInfoImpl pui) { SessionLog traceLogger = new TraceLog(); Properties properties = pui.getProperties(); String productName = properties.getProperty(PersistenceUnitProperties.SCHEMA_DATABASE_PRODUCT_NAME); String vendorNameAndVersion = null; // check persistent properties if (productName != null) { vendorNameAndVersion = productName; String majorVersion = properties.getProperty(PersistenceUnitProperties.SCHEMA_DATABASE_MAJOR_VERSION); if (majorVersion != null) { vendorNameAndVersion += majorVersion; String minorVersion = properties.getProperty(PersistenceUnitProperties.SCHEMA_DATABASE_MINOR_VERSION); if (minorVersion != null) { vendorNameAndVersion += minorVersion; } } } else { vendorNameAndVersion = getVendorNameAndVersion(pui.getJtaDataSource()); if (vendorNameAndVersion == null) { getVendorNameAndVersion(pui.getNonJtaDataSource()); } } return DBPlatformHelper.getDBPlatform(vendorNameAndVersion, traceLogger); }
java
@FFDCIgnore(SQLException.class) private Boolean supportsUnicodeStaticCheck(DataSource ds) { Boolean res = null; try { Connection conn = ds.getConnection(); String product = null; try { DatabaseMetaData dmd = conn.getMetaData(); product = dmd.getDatabaseProductName(); if (tc.isDebugEnabled()) { Tr.debug(tc, "supportsUnicodeStaticCheck : getDatabaseProductName = " + product); } } finally { conn.close(); } for (Pattern supportedPattern : _unicodeSupportPlatform) { if (supportedPattern.matcher(product).matches()) { if (tc.isDebugEnabled()) { Tr.debug(tc, "matched _unicodeSupportPlatform=" + supportedPattern.pattern()); } return Boolean.TRUE; } } for (Pattern unsupported : _noUnicodeSupportPlatform) { if (unsupported.matcher(product).matches()) { if (tc.isDebugEnabled()) { Tr.debug(tc, "matched _noUnicodeSupportPlatform=" + unsupported.pattern()); } return Boolean.FALSE; } } } catch (SQLException e) { // Unexpected if (tc.isDebugEnabled()) { Tr.debug(tc, "Something went wrong in supportsUnicodeStaticCheck() -- ", e); } } return res; }
java
public void setMessagingAuthorizationService( MessagingAuthorizationService messagingAuthorizationService) { SibTr.entry(tc, CLASS_NAME + "setMessagingAuthorizationService", messagingAuthorizationService); this.messagingAuthorizationService = messagingAuthorizationService; SibTr.exit(tc, CLASS_NAME + "setMessagingAuthorizationService"); }
java
@Override public void destroy() throws Exception { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(this, tc, "destroy", id); tracker.close(); StringBuilder filter = new StringBuilder(FilterUtils.createPropertyFilter(AbstractConnectionFactoryService.ID, id)); filter.insert(filter.length() - 1, '*'); builder.removeExistingConfigurations(filter.toString()); if (trace && tc.isEntryEnabled()) Tr.exit(this, tc, "destroy"); }
java
public void addMPDestinationChangeListener(MPDestinationChangeListener destinationChangeListener) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addMPDestinationChangeListener", new Object[]{destinationChangeListener}); _destinationChangeListeners.add(destinationChangeListener); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addMPDestinationChangeListener"); }
java
public void removeMPDestinationChangeListener(MPDestinationChangeListener destinationChangeListener) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeMPDestinationChangeListener", new Object[]{destinationChangeListener}); _destinationChangeListeners.remove(destinationChangeListener); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeMPDestinationChangeListener"); }
java
private Set getDestinationLocalitySet (BaseDestinationHandler destinationHandler, Capability capability) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getDestinationLocalitySet", new Object[]{destinationHandler, capability}); // Check if the localisation should be deleted Set localitySet = null; //Get the locality sets as known by admin try { localitySet = _messageProcessor.getSIBDestinationLocalitySet(null, destinationHandler.getUuid().toString(), true); } catch(SIBExceptionBase e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.DestinationChangeListener.getDestinationLocalitySet", "1:368:1.45", this); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestinationLocalitySet", localitySet); return localitySet; }
java
private void cleanupDestination(PtoPMessageItemStream ptoPMessageItemStream, BaseDestinationHandler destinationHandler, SIBUuid8 meUuid, Capability capability) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "cleanupDestination", new Object[]{ptoPMessageItemStream, destinationHandler, meUuid, capability}); // The localisation is not known in WCCM or WLM, so mark it for deletion try { ptoPMessageItemStream.markAsToBeDeleted(_txManager.createAutoCommitTransaction()); //Capability == GET Close any remote consumers from the destination destinationHandler.closeRemoteConsumer(meUuid); } catch(SIResourceException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.DestinationChangeListener.cleanupDestination", "1:424:1.45", this); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "cleanupDestination"); }
java
private void compareToAparList(ExecutionContext context, CommandConsole console, Map<String, Set<String>> installedIFixes, File wlpInstallationDirectory) { // console.printlnInfoMessage("WLP Directory [ " + wlpInstallationDirectory.getPath() + " ]"); // console.printlnInfoMessage("Installed IFixes [ " + installedIFixes.keySet() + " ]"); // First grab the apar list String aparListString = context.getOptionValue(APAR_TO_COMPARE_OPTION); List<String> aparList; // Service 83179: String.split yields a singleton list on an empty string! aparListString = aparListString.trim(); if (aparListString.isEmpty()) { aparList = Collections.emptyList(); } else { // Service 83179: Trim spaces and duplicates; delimit on space and tab, too. aparList = new ArrayList<String>(); String[] aparListArray = aparListString.split(",| |\t"); for (String apar : aparListArray) { apar = apar.trim(); if (!apar.isEmpty() && !aparList.contains(apar)) { aparList.add(apar); } } } // console.printlnInfoMessage("APAR List String [ " + aparListString + " ]"); // console.printlnInfoMessage("APAR List [ " + Arrays.toString(aparList) + " ]"); // We now know what APARs to look for so load which ones are installed from both iFixes and Fix Packs Set<String> aparsInstalled = null; try { aparsInstalled = findFixPackAparIds(wlpInstallationDirectory, console, context); } catch (IllegalArgumentException e) { // These are thrown by the methods when the inputs were invalid and should have the message set to something readable to the user console.printlnErrorMessage(e.getMessage()); return; } catch (ZipException e) { console.printlnErrorMessage(getMessage("compare.error.reading.install", wlpInstallationDirectory, e.getMessage())); return; } catch (IOException e) { console.printlnErrorMessage(getMessage("compare.error.reading.install", wlpInstallationDirectory, e.getMessage())); return; } // console.printlnInfoMessage("Installed APARs [ " + aparsInstalled + " ]"); aparsInstalled.addAll(installedIFixes.keySet()); // Service 83179: Use a list: Keep the missing APARs in the order as originally specified. List<String> missingApars = new ArrayList<String>(); for (String apar : aparList) { if (!aparsInstalled.contains(apar)) { missingApars.add(apar); } } // console.printlnInfoMessage("Missing APARS [ " + missingApars.size() + " ] [ " + missingApars + " ]"); if (missingApars.isEmpty()) { // Output a message saying all APARs were present console.printlnInfoMessage(getMessage("compare.all.apars.present")); } else { // Output a message saying which APARs were missing console.printlnInfoMessage(getMessage("compare.missing.apars", missingApars.toString())); } }
java
private void compareToInstallLocation(ExecutionContext context, CommandConsole console, Map<String, Set<String>> aparToIFixMap, File wlpInstallationDirectory) { String installToCompareToLocation = context.getOptionValue(INSTALL_LOCATION_TO_COMPARE_TO_OPTION); File installToCompareToFile = new File(installToCompareToLocation); if (!installToCompareToFile.exists()) { console.printlnErrorMessage(getMessage("compare.to.option.does.not.exist", installToCompareToLocation)); return; } Set<String> aparsForNewInstall = null; try { aparsForNewInstall = findFixPackAparIds(installToCompareToFile, console, context); } catch (IllegalArgumentException e) { // These are thrown by the methods when the inputs were invalid and should have the message set to something readable to the user console.printlnErrorMessage(e.getMessage()); return; } catch (ZipException e) { console.printlnErrorMessage(getMessage("compare.error.reading.install", installToCompareToLocation, e.getMessage())); return; } catch (IOException e) { console.printlnErrorMessage(getMessage("compare.error.reading.install", installToCompareToLocation, e.getMessage())); return; } // Go through all of the APARs that are currently installed and make sure they are in the new version Map<String, Set<String>> missingApars = new HashMap<String, Set<String>>(); for (Map.Entry<String, Set<String>> aparIFixInfo : aparToIFixMap.entrySet()) { String apar = aparIFixInfo.getKey(); if (!aparsForNewInstall.contains(apar)) { missingApars.put(apar, aparIFixInfo.getValue()); } } // Output the result, this will consist of a message saying if there were any missing iFixes then details on what was missing and what was included if (missingApars.isEmpty()) { console.printlnInfoMessage(getMessage("compare.all.ifixes.present", wlpInstallationDirectory.getAbsolutePath(), installToCompareToLocation)); } else { console.printlnInfoMessage(getMessage("compare.ifixes.missing", wlpInstallationDirectory.getAbsolutePath(), installToCompareToLocation)); console.printlnInfoMessage(""); console.printlnInfoMessage(getMessage("compare.list.missing.ifixes", wlpInstallationDirectory.getAbsolutePath(), installToCompareToLocation)); printAparIFixInfo(console, missingApars); } // Now print the included APARs by removing all of the missing ones for (String missingApar : missingApars.keySet()) { aparToIFixMap.remove(missingApar); } if (!aparToIFixMap.isEmpty()) { console.printlnInfoMessage(""); console.printlnInfoMessage(getMessage("compare.list.included.ifixes", wlpInstallationDirectory.getAbsolutePath(), installToCompareToLocation)); printAparIFixInfo(console, aparToIFixMap); } }
java
private void printAparIFixInfo(CommandConsole console, Map<String, Set<String>> aparToIFixMap) { for (Map.Entry<String, Set<String>> aparIFixInfo : aparToIFixMap.entrySet()) { console.printlnInfoMessage(getMessage("compare.ifix.apar.info", aparIFixInfo.getKey(), aparIFixInfo.getValue())); } }
java
private Version getProductVersion(File wlpInstallationDirectory) throws VersionParsingException { // First get the properties Map<String, ProductInfo> productProperties = VersionUtils.getAllProductInfo(wlpInstallationDirectory); // Get the properties for WAS ProductInfo wasProperties = productProperties.get("com.ibm.websphere.appserver"); if (wasProperties == null) { throw new VersionParsingException(getMessage("compare.no.was.properties.found")); } Version version = convertVersion(wasProperties); return version; }
java
private String readLine(InputStream stream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); return reader.readLine(); }
java
public void service(ServletRequest req, ServletResponse resp) throws ServletException, IOException { try { TimedServletPoolElement e = _pool.getNextElement(); e.getServlet().service(req, resp); _pool.returnElement(e); _pool.removeExpiredElements(); } catch (Throwable th) { com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, "com.ibm.ws.webcontainer.servlet.SingleThreadModelServlet.service", "84", this); throw new ServletErrorReport(th); } }
java
public ModuleItem find(String name) { if (children == null) return null; else return (ModuleItem) children.get(name); /* * for(int i=0; i<children.size(); i++) * { * ModuleItem item = (ModuleItem)children.get(i); * if(item.instance != null) * { * if(item.instance.getName().equals(name)) * return item; * } * } * return null; */ }
java
public ModuleItem find(String[] path, int index) { if (path == null) return null; if (path.length == 0) return this; ModuleItem item = find(path[index]); if (item == null) return null; if (index == path.length - 1) return item; else return item.find(path, index + 1); }
java
public synchronized ModuleItem add(String[] path, int index) { if (path == null) return null; if (path.length == 0) return this; ModuleItem item = find(path[index]); // custom module shouldn't go inside if{} if (item == null) { // Create Aggregate Module String[] myPath = new String[index + 1]; System.arraycopy(path, 0, myPath, 0, myPath.length); if (myPath.length == 1) { // first layer will have aggregation ModuleAggregate aggregate = new ModuleAggregate(myPath[0]); item = find(path[index]); } else if (myPath.length == 3) { // this is supposed to be submdoule layer new ModuleAggregate(myPath[0], myPath[1], myPath[2]); item = find(path[index]); } else { // lower levels will not have aggregation //item = new ModuleItem(new PmiModuleDummyImpl(myPath)); Tr.warning(tc, "PMI9999E", "Parent module not found."); } // Add aggregate module to tree add(item); } if (index == path.length - 1) return item; else return item.add(path, index + 1); }
java
public ModuleItem[] children() { if (children == null) return null; ModuleItem[] members = new ModuleItem[children.size()]; children.values().toArray(members); return members; }
java
public synchronized void remove(ModuleItem item) { if (item == null || children == null) return; // remove from all the parents which have links to it due to aggregate data PmiModule removeInstance = item.getInstance(); if (!(removeInstance instanceof PmiModuleAggregate)) { // recursively remove aggregate data for parents ModuleItem myParent = this; PmiModule parModule = null; while (myParent != null) { parModule = myParent.getInstance(); // if parent is aggregate if (parModule != null && parModule instanceof PmiModuleAggregate) ((PmiModuleAggregate) parModule).remove(removeInstance); myParent = myParent.getParent(); } } // remove any children item._cleanChildren(); // remove ModuleItem children.remove(item.getInstance().getName()); if (myStatsWithChildren != null) { updateStatsTree(); } //bStatsTreeNeedsUpdate = true; // remove mbean mapping and deactivate any CustomStats mbean //_cleanMBean(item); item.getInstance().cleanup(); item = null; }
java
public DataDescriptor[] listMembers(DataDescriptor dd, boolean jmxBased) { // take care of data members SpdData[] dataList = null; int dataLength = 0; if (!jmxBased) { dataList = instance.listData(); if (dataList != null) dataLength = dataList.length; } // take care of non-data members String[] nameList = null; int itemLength = 0; ModuleItem[] items = children(); if (items != null) { itemLength = items.length; nameList = new String[itemLength]; for (int i = 0; i < itemLength; i++) { String[] path = items[i].getInstance().getPath(); nameList[i] = path[path.length - 1]; } } // create the returned array // return both item (instance/submodule) descriptor and data descriptor if any if (itemLength == 0 && dataLength == 0) return null; DataDescriptor[] res = new DataDescriptor[itemLength + dataLength]; for (int i = 0; i < itemLength; i++) { res[i] = new DataDescriptor(dd, nameList[i]); } for (int i = 0; i < dataLength; i++) { res[i + itemLength] = new DataDescriptor(dd, dataList[i].getId()); } return res; }
java
public StatsImpl getStats(boolean recursive) { // DO THIS METHOD NEED SYNCHRONIZED ACCESS? // When multiple threads get inside the method and stats tree is updated if (recursive) { /* * // if leaf then do not create myStatsWithChildren. Instead return myStats * if (children == null && !bStatsTreeNeedsUpdate) * { * // return myStats * if (myStats == null) * { * if (instance != null) * myStats = instance.getStats (instance.listStatistics(), null); * else * myStats = new StatsImpl("server", TYPE_SERVER, level, null, null); * } * * return myStats; * } * else */ // first time here if (myStatsWithChildren == null) { ArrayList dataMembers = null; if (instance != null) dataMembers = instance.listStatistics(); ArrayList colMembers = null; // return subcollection members // getStats from children ModuleItem[] items = children(); if (items != null) { colMembers = new ArrayList(items.length); for (int i = 0; i < items.length; i++) { colMembers.add(items[i].getStats(recursive)); } } if (instance != null) myStatsWithChildren = instance.getStats(dataMembers, colMembers); else myStatsWithChildren = new StatsImpl("server", TYPE_SERVER, level, null, colMembers); } else { updateStatisticsForStatsTree(System.currentTimeMillis()); // update external & aggregate statistics } return myStatsWithChildren; } // NON-RECURSIVE else { if (myStats == null) { if (instance != null) myStats = instance.getStats(instance.listStatistics(), null); else myStats = new StatsImpl("server", TYPE_SERVER, level, null, null); } else { if (instance != null) instance.updateStatistics(); // update external & aggregate statistics myStats.setTime(System.currentTimeMillis()); } return myStats; } /* * ArrayList dataMembers = instance.listStatistics(); * ArrayList colMembers = null; // return subcollection members * * if (recursive) * { * ModuleItem[] items = children(); * * // getStats from children * if(items != null) * { * colMembers = new ArrayList(items.length); * for(int i=0; i<items.length; i++) * { * colMembers.add(items[i].getStats(recursive)); * } * } * } * * // return Stats - individual instance will return different XXXStats instance * // Note: construct dataMembers in ModuleItem and pass it to instance * // because getStats will be overwritten by subclasses * // and we don't want to duplicate the same code. * * return instance.getStats(dataMembers, colMembers); */ }
java
private void setInstanceLevel_FG(int[] enabled, int[] enabledSync, boolean recursive) { if (instance != null) { // Fine grained instrumentation overrides the old level // First call setFineGrainedInstrumentation. // If fine grained level is undefined called old setInstrumentationLevel boolean action = instance.setFineGrainedInstrumentation(enabled, enabledSync); /* * not need since PmiConfigManager.updateWithRuntimeSpec is always called before persisting * // Update in-memory EMF object (PMIModule) * // call instance.getEnabled() to save the filtered set (filtering done by setFineGrainedInstrumentation, specifically bean module methods) * if (PmiConfigManager.isInitialized()) * PmiConfigManager.updateSpec(instance.getPath(), instance.getWCCMStatsType(), instance.getEnabled(), instance.getEnabledSync(), false, false); */ // FIXME: updating parent. may need to call this conditionally - when there is a change in fg spec updateParent(); } if (recursive) { ModuleItem[] items = children(); if (items == null) return; for (int i = 0; i < items.length; i++) { items[i].setInstanceLevel_FG(enabled, enabledSync, recursive); } } }
java
private void _cleanChildren() { //bStatsTreeNeedsUpdate = true; if (children != null) { Iterator values = children.values().iterator(); while (values.hasNext()) { ModuleItem remMI = (ModuleItem) values.next(); remMI.getInstance().cleanup(); //_cleanMBean(remMI); remMI._cleanChildren(); remMI = null; } children.clear(); } }
java
protected void configureCustomizeBinding(Client client, QName portName) { //put all properties defined in ibm-ws-bnd.xml into the client request context Map<String, Object> requestContext = client.getRequestContext(); if (null != requestContext && null != wsrInfo) { PortComponentRefInfo portRefInfo = wsrInfo.getPortComponentRefInfo(portName); Map<String, String> wsrProps = wsrInfo.getProperties(); Map<String, String> portProps = (null != portRefInfo) ? portRefInfo.getProperties() : null; if (null != wsrProps) { requestContext.putAll(wsrProps); } if (null != portProps) { requestContext.putAll(portProps); } if (null != wsrProps && Boolean.valueOf(wsrProps.get(JaxWsConstants.ENABLE_lOGGINGINOUTINTERCEPTOR))) { List<Interceptor<? extends Message>> inInterceptors = client.getInInterceptors(); inInterceptors.add(new LoggingInInterceptor()); List<Interceptor<? extends Message>> outInterceptors = client.getOutInterceptors(); outInterceptors.add(new LoggingOutInterceptor()); } } Set<ConfigProperties> configPropsSet = servicePropertiesMap.get(portName); client.getOutInterceptors().add(new LibertyCustomizeBindingOutInterceptor(wsrInfo, securityConfigService, configPropsSet)); //need to add an interceptor to clean up HTTPTransportActivator.sorted & props via calling HTTPTransportActivator. deleted(String) //Memory Leak fix for 130985 client.getOutInterceptors().add(new LibertyCustomizeBindingOutEndingInterceptor(wsrInfo)); }
java
private WebServiceFeature[] getWebServiceFeaturesOnPortComponentRef(Class serviceEndpointInterface) { WebServiceFeature[] returnArray = {}; if (serviceEndpointInterface != null && wsrInfo != null) { String seiName = serviceEndpointInterface.getName(); PortComponentRefInfo pcr = wsrInfo.getPortComponentRefInfo(seiName); if (tc.isDebugEnabled()) { Tr.debug(tc, "SEI name = " + seiName); Tr.debug(tc, "PortComponentRefInfo found = " + pcr); } if (pcr != null) { List<WebServiceFeatureInfo> featureInfoList = pcr.getWebServiceFeatureInfos(); if (tc.isDebugEnabled()) { Tr.debug(tc, "List of WebServiceFeatureInfo from PortComponentRefInfo = " + featureInfoList); } if (!featureInfoList.isEmpty()) { returnArray = new WebServiceFeature[featureInfoList.size()]; for (int i = 0; i < featureInfoList.size(); i++) { WebServiceFeatureInfo featureInfo = featureInfoList.get(i); WebServiceFeature wsf = featureInfo.getWebServiceFeature(); returnArray[i] = wsf; if (tc.isDebugEnabled()) { Tr.debug(tc, "Added WebServiceFeature " + wsf); } } } } } return returnArray; }
java
private void configureClientProperties() throws IOException { Map<String, String> serviceRefProps = wsrInfo.getProperties(); Iterator<QName> iterator = this.getPorts();//wsrInfo.getBindingPortComponentRefInfoList(); while (null != iterator && iterator.hasNext()) { QName portQName = iterator.next(); PortComponentRefInfo portInfo = wsrInfo.getPortComponentRefInfo(portQName); Map<String, String> portProps = (null != portInfo) ? portInfo.getProperties() : null; if ((null != serviceRefProps || null != portProps)) { prepareProperties(portQName, serviceRefProps, portProps); } } }
java
private void prepareProperties(QName portQName, Map<String, String> serviceRefProps, Map<String, String> portProps) throws IOException { // Merge the properties form port and service. Map<String, String> allProperties = new HashMap<String, String>(); if (null != serviceRefProps) { allProperties.putAll(serviceRefProps); } if (null != portProps) { allProperties.putAll(portProps); } for (Map.Entry<String, String> entry : servicePidToPropertyPrefixMap.entrySet()) { String serviceFactoryPid = entry.getKey(); String prefix = entry.getValue(); // Extract the properties according to different property prefix, // update the extracted properties by corresponding factory service. Map<String, String> extractProps = extract(prefix, allProperties); // Put the port QName and the properties into the servicePropertiesMap ConfigProperties configProps = new ConfigProperties(serviceFactoryPid, extractProps); Set<ConfigProperties> configSet = servicePropertiesMap.get(portQName); if (null == configSet) { configSet = new HashSet<ConfigProperties>(); servicePropertiesMap.put(portQName, configSet); } if (configSet.contains(configProps)) { // re-add the config props configSet.remove(configProps); configSet.add(configProps); } else { configSet.add(configProps); } } }
java
protected Map<String, String> extract(String propertyPrefix, Map<String, String> properties, boolean removeProps) { if (null == properties || properties.isEmpty()) { return Collections.<String, String> emptyMap(); } Map<String, String> extractProps = new HashMap<String, String>(); Iterator<Map.Entry<String, String>> propIter = properties.entrySet().iterator(); while (propIter.hasNext()) { Map.Entry<String, String> propEntry = propIter.next(); if (null != propEntry.getKey() && propEntry.getKey().startsWith(propertyPrefix)) { String propKey = propEntry.getKey().substring(propertyPrefix.length()); extractProps.put(propKey, propEntry.getValue()); if (removeProps) { propIter.remove(); } } } return extractProps; }
java
protected Map<String, String> extract(String propertyPrefix, Map<String, String> properties) { return extract(propertyPrefix, properties, true); }
java
private boolean isKnownArgument(String arg) { final String argName = getArgName(arg); for (String key : knownArgs) { if (key.equalsIgnoreCase(argName)) { return true; } } return false; }
java
protected String getTaskHelp(String desc, String usage, String optionKeyPrefix, String optionDescPrefix, String addonKey, String footer, Object... args) { StringBuilder scriptHelp = new StringBuilder(); scriptHelp.append(NL); scriptHelp.append(getOption("global.description")); scriptHelp.append(NL); scriptHelp.append(getOption(desc)); scriptHelp.append(NL); // print a empty line scriptHelp.append(NL); scriptHelp.append(getOption("global.usage")); scriptHelp.append(NL); scriptHelp.append(getOption(usage)); scriptHelp.append(NL); String options = buildScriptOptions(optionKeyPrefix, optionDescPrefix); if (!options.isEmpty()) { // print a empty line scriptHelp.append(NL); scriptHelp.append(getOption("global.options")); scriptHelp.append(options); } if (addonKey != null && !addonKey.isEmpty()) { // print a empty line scriptHelp.append(NL); scriptHelp.append(getOption(addonKey)); } if (footer != null && !footer.isEmpty()) { scriptHelp.append(footer); } scriptHelp.append(NL); if (args.length == 0) { return scriptHelp.toString(); } else { return MessageFormat.format(scriptHelp.toString(), args); } }
java
public String getDestination() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getDestination"); SibTr.exit(tc, "getDestination", destination); } return destination; }
java
public String getSelector() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getSelector"); SibTr.exit(tc, "getSelector", selector); } return selector; }
java
public int getSelectorDomain() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getSelectorDomain"); SibTr.exit(tc, "getSelectorDomain", new Integer(selectorDomain)); } return selectorDomain; }
java