_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q172700 | Configuration.needClassFileTransformer | test | public static boolean needClassFileTransformer(PersistenceUnitMetadata pu) {
boolean result = true;
String provider = pu.getPersistenceProviderClassName();
if (pu.getProperties().containsKey(Configuration.JPA_CONTAINER_CLASS_TRANSFORMER)) {
result = Boolean.parseBoolean(pu.getProperties().getProperty(Configuration.JPA_CONTAINER_CLASS_TRANSFORMER));
}
else if (isHibernateProvider(provider)) {
result = (Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_USE_CLASS_ENHANCER))
|| Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_DIRTY_TRACKING))
|| Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_LAZY_INITIALIZATION))
|| Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_ASSOCIATION_MANAGEMENT)));
}
return result;
} | java | {
"resource": ""
} |
q172701 | Configuration.allowTwoPhaseBootstrap | test | public static boolean allowTwoPhaseBootstrap(PersistenceUnitMetadata pu) {
boolean result = true;
if (EE_DEFAULT_DATASOURCE.equals(pu.getJtaDataSourceName())) {
result = false;
}
if (pu.getProperties().containsKey(Configuration.JPA_ALLOW_TWO_PHASE_BOOTSTRAP)) {
result = Boolean.parseBoolean(pu.getProperties().getProperty(Configuration.JPA_ALLOW_TWO_PHASE_BOOTSTRAP));
}
return result;
} | java | {
"resource": ""
} |
q172702 | Configuration.allowDefaultDataSourceUse | test | public static boolean allowDefaultDataSourceUse(PersistenceUnitMetadata pu) {
boolean result = true;
if (pu.getProperties().containsKey(Configuration.JPA_ALLOW_DEFAULT_DATA_SOURCE_USE)) {
result = Boolean.parseBoolean(pu.getProperties().getProperty(Configuration.JPA_ALLOW_DEFAULT_DATA_SOURCE_USE));
}
return result;
} | java | {
"resource": ""
} |
q172703 | Configuration.skipMixedSynchronizationTypeCheck | test | public static boolean skipMixedSynchronizationTypeCheck(EntityManagerFactory emf, Map targetEntityManagerProperties) {
boolean result = false;
// EntityManager properties will take priority over persistence.xml level (emf) properties
if(targetEntityManagerProperties != null && targetEntityManagerProperties.containsKey(SKIPMIXEDSYNCTYPECHECKING)) {
result = Boolean.parseBoolean((String) targetEntityManagerProperties.get(SKIPMIXEDSYNCTYPECHECKING));
}
else if(emf.getProperties() != null && emf.getProperties().containsKey(SKIPMIXEDSYNCTYPECHECKING)) {
result = Boolean.parseBoolean((String) emf.getProperties().get(SKIPMIXEDSYNCTYPECHECKING));
}
return result;
} | java | {
"resource": ""
} |
q172704 | CorbaUtils.getOrb | test | public static ORB getOrb(String server, int port, Hashtable env) {
// See if we can get info from environment
Properties orbProp;
// Extract any org.omg.CORBA properties from environment
if (env != null) {
// Get all String properties
orbProp = new Properties();
final Enumeration envProp = env.keys();
while (envProp.hasMoreElements()) {
String key = (String) envProp.nextElement();
Object val = env.get(key);
if (val instanceof String) {
orbProp.put(key, val);
}
}
final Enumeration mainProps = orbProperties.keys();
while (mainProps.hasMoreElements()) {
String key = (String) mainProps.nextElement();
Object val = orbProperties.get(key);
if (val instanceof String) {
orbProp.put(key, val);
}
}
} else {
orbProp = orbProperties;
}
if (server != null) {
orbProp.put("org.omg.CORBA.ORBInitialHost", server);
}
if (port >= 0) {
orbProp.put("org.omg.CORBA.ORBInitialPort", "" + port);
}
// Get Applet from environment
if (env != null) {
Object applet = env.get(Context.APPLET);
if (applet != null) {
// Create ORBs for an applet
return initAppletORB(applet, orbProp);
}
}
// Create ORBs using orbProp for a standalone application
return ORB.init(new String[0], orbProp);
} | java | {
"resource": ""
} |
q172705 | CorbaUtils.initAppletORB | test | private static ORB initAppletORB(Object applet, Properties orbProp) {
try {
Class<?> appletClass = Class.forName("java.applet.Applet", true, null);
if (!appletClass.isInstance(applet)) {
throw new ClassCastException(applet.getClass().getName());
}
// invoke the static method ORB.init(applet, orbProp);
Method method = ORB.class.getMethod("init", appletClass, Properties.class);
return (ORB) method.invoke(null, applet, orbProp);
} catch (ClassNotFoundException e) {
// java.applet.Applet doesn't exist and the applet parameter is
// non-null; so throw CCE
throw new ClassCastException(applet.getClass().getName());
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
throw (Error) cause;
}
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
} | java | {
"resource": ""
} |
q172706 | CorbaUtils.initMethodHandles | test | private static void initMethodHandles() throws ClassNotFoundException {
// Get javax.rmi.CORBA.Stub class
corbaStubClass = Class.forName("javax.rmi.CORBA.Stub");
// Get javax.rmi.CORBA.Stub.connect(org.omg.CORBA.ORB) method
try {
connectMethod = corbaStubClass.getMethod("connect", new Class[]{org.omg.CORBA.ORB.class});
} catch (NoSuchMethodException e) {
throw IIOPLogger.ROOT_LOGGER.noMethodDefForStubConnect();
}
// Get javax.rmi.PortableRemoteObject method
Class proClass = Class.forName("javax.rmi.PortableRemoteObject");
// Get javax.rmi.PortableRemoteObject(java.rmi.Remote) method
try {
toStubMethod = proClass.getMethod("toStub", new Class[]{java.rmi.Remote.class});
} catch (NoSuchMethodException e) {
throw IIOPLogger.ROOT_LOGGER.noMethodDefForPortableRemoteObjectToStub();
}
} | java | {
"resource": ""
} |
q172707 | NamingContext.setActiveNamingStore | test | public static void setActiveNamingStore(final NamingStore namingStore) {
if(WildFlySecurityManager.isChecking()) {
System.getSecurityManager().checkPermission(SET_ACTIVE_NAMING_STORE);
}
ACTIVE_NAMING_STORE = namingStore;
} | java | {
"resource": ""
} |
q172708 | JaxrsMethodParameterProcessor.validateDefaultValues | test | private void validateDefaultValues(List<ParamDetail> detailList,
HashMap<String, List<Validator>> paramConverterMap)
throws DeploymentUnitProcessingException {
for(ParamDetail detail : detailList) {
// check param converter for specific return type
List<Validator> validators = paramConverterMap.get(
detail.parameter.getName());
if (validators == null) {
// check for paramConverterProvider
validators = paramConverterMap.get(Object.class.getName());
}
boolean isCheckClazzMethods = true;
if (validators != null) {
for (Validator v : validators) {
if (!v.isLazyLoad()) {
try {
Object obj = v.verify(detail);
if (obj != null) {
isCheckClazzMethods = false;
break;
}
} catch (Exception e) {
JAXRS_LOGGER.paramConverterFailed(detail.defaultValue.value(),
detail.parameter.getSimpleName(),
detail.method.toString(),
v.toString(), e.getClass().getName(),
e.getMessage());
}
}
}
}
if (isCheckClazzMethods) {
Class baseType = detail.parameter;
Method valueOf = null;
// constructor rule
try {
Constructor<?> ctor = baseType.getConstructor(String.class);
if (Modifier.isPublic(ctor.getModifiers())) {
continue; // success move to next detail
}
} catch (NoSuchMethodException ignored) { }
// method fromValue(String.class) rule
try {
Method fromValue = baseType.getDeclaredMethod("fromValue", String.class);
if (Modifier.isPublic(fromValue.getModifiers())) {
for (Annotation ann : baseType.getAnnotations()) {
if (ann.annotationType().getName()
.equals("javax.xml.bind.annotation.XmlEnum")) {
valueOf = fromValue;
}
}
validateBaseType(fromValue, detail.defaultValue.value(), detail);
continue; // success move to next detail
}
} catch (NoSuchMethodException ignoredA) { }
// method fromString(String.class) rule
Method fromString = null;
try {
fromString = baseType.getDeclaredMethod("fromString", String.class);
if (Modifier.isStatic(fromString.getModifiers())) {
validateBaseType(fromString, detail.defaultValue.value(), detail);
continue; // success move to next detail
}
} catch (NoSuchMethodException ignoredB) {
}
// method valueof(String.class) rule
try {
valueOf = baseType.getDeclaredMethod("valueOf", String.class);
if (Modifier.isStatic(valueOf.getModifiers())) {
validateBaseType(valueOf, detail.defaultValue.value(), detail);
continue; // success move to next detail
}
} catch (NoSuchMethodException ignored) {
}
}
}
} | java | {
"resource": ""
} |
q172709 | JaxrsMethodParameterProcessor.checkParamType | test | private Class checkParamType(Type genParamType, final Method method,
final int paramPos, final ClassLoader classLoader){
Class paramClazz = null;
if (genParamType instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) genParamType;
Type[] actualTypeArgs = pType.getActualTypeArguments();
// skip Map types. Don't know how to set default value for these
if (actualTypeArgs.length == 1) {
try {
paramClazz = classLoader.loadClass(actualTypeArgs[0].getTypeName());
} catch (Exception ee) {
JAXRS_LOGGER.classIntrospectionFailure(ee.getClass().getName(),
ee.getMessage());
}
}
} else {
Class<?>[] paramArr = method.getParameterTypes();
if (paramArr[paramPos].isArray()) {
Class compClazz = paramArr[paramPos].getComponentType();
if (!compClazz.isPrimitive()) {
paramClazz = compClazz;
}
} else {
if (!paramArr[paramPos].isPrimitive()) {
paramClazz = paramArr[paramPos];
}
}
}
return paramClazz;
} | java | {
"resource": ""
} |
q172710 | JaxrsMethodParameterProcessor.lookupDefaultValueAnn | test | private DefaultValue lookupDefaultValueAnn(Annotation[] annotationArr) {
for (Annotation ann : annotationArr) {
if (ann instanceof DefaultValue) {
return (DefaultValue)ann;
}
}
return null;
} | java | {
"resource": ""
} |
q172711 | JaxrsMethodParameterProcessor.validateBaseType | test | private void validateBaseType(Method method, String defaultValue, ParamDetail detail)
throws DeploymentUnitProcessingException {
if (defaultValue != null) {
try {
method.invoke(method.getDeclaringClass(), defaultValue);
} catch (Exception e) {
JAXRS_LOGGER.baseTypeMethodFailed(defaultValue,
detail.parameter.getSimpleName(), detail.method.toString(),
method.toString(), e.getClass().getName(),
e.getMessage());
}
}
} | java | {
"resource": ""
} |
q172712 | CreatedEntityManagers.getDeferredEntityManagers | test | public static ExtendedEntityManager[] getDeferredEntityManagers() {
List<ExtendedEntityManager> store = deferToPostConstruct.get();
try {
if(store.isEmpty()) {
return EMPTY;
} else {
return store.toArray(new ExtendedEntityManager[store.size()]);
}
} finally {
store.clear();
}
} | java | {
"resource": ""
} |
q172713 | StatusHelper.statusAsString | test | public static String statusAsString(int status) {
if (status >= Status.STATUS_ACTIVE && status <= Status.STATUS_ROLLING_BACK) {
return TxStatusStrings[status];
} else {
return "STATUS_INVALID(" + status + ")";
}
} | java | {
"resource": ""
} |
q172714 | Notification.addCacheDependencies | test | public static void addCacheDependencies(Classification cacheType, Properties properties) {
for(EventListener eventListener: eventListeners) {
eventListener.addCacheDependencies(cacheType, properties);
}
} | java | {
"resource": ""
} |
q172715 | DatabaseTimerPersistence.extractDialects | test | private void extractDialects() {
for (Object prop : sql.keySet()) {
int dot = ((String)prop).indexOf('.');
if (dot > 0) {
databaseDialects.add(((String)prop).substring(dot+1));
}
}
} | java | {
"resource": ""
} |
q172716 | DatabaseTimerPersistence.investigateDialect | test | private void investigateDialect() {
Connection connection = null;
if (database == null) {
// no database dialect from configuration guessing from MetaData
try {
connection = dataSource.getConnection();
DatabaseMetaData metaData = connection.getMetaData();
String dbProduct = metaData.getDatabaseProductName();
database = identifyDialect(dbProduct);
if (database == null) {
EjbLogger.EJB3_TIMER_LOGGER.debug("Attempting to guess on driver name.");
database = identifyDialect(metaData.getDriverName());
}
} catch (Exception e) {
EjbLogger.EJB3_TIMER_LOGGER.debug("Unable to read JDBC metadata.", e);
} finally {
safeClose(connection);
}
if (database == null) {
EjbLogger.EJB3_TIMER_LOGGER.jdbcDatabaseDialectDetectionFailed(databaseDialects.toString());
} else {
EjbLogger.EJB3_TIMER_LOGGER.debugf("Detect database dialect as '%s'. If this is incorrect, please specify the correct dialect using the 'database' attribute in your configuration. Supported database dialect strings are %s", database, databaseDialects);
}
} else {
EjbLogger.EJB3_TIMER_LOGGER.debugf("Database dialect '%s' read from configuration, adjusting it to match the final database valid value.", database);
database = identifyDialect(database);
EjbLogger.EJB3_TIMER_LOGGER.debugf("New Database dialect is '%s'.", database);
}
} | java | {
"resource": ""
} |
q172717 | DatabaseTimerPersistence.identifyDialect | test | private String identifyDialect(String name) {
String unified = null;
if (name != null) {
if (name.toLowerCase().contains("postgres")) {
unified = "postgresql";
} else if (name.toLowerCase().contains("mysql")) {
unified = "mysql";
} else if (name.toLowerCase().contains("mariadb")) {
unified = "mariadb";
} else if (name.toLowerCase().contains("db2")) {
unified = "db2";
} else if (name.toLowerCase().contains("hsql") || name.toLowerCase().contains("hypersonic")) {
unified = "hsql";
} else if (name.toLowerCase().contains("h2")) {
unified = "h2";
} else if (name.toLowerCase().contains("oracle")) {
unified = "oracle";
}else if (name.toLowerCase().contains("microsoft")) {
unified = "mssql";
}else if (name.toLowerCase().contains("jconnect")) {
unified = "sybase";
}
}
EjbLogger.EJB3_TIMER_LOGGER.debugf("Check dialect for '%s', result is '%s'", name, unified);
return unified;
} | java | {
"resource": ""
} |
q172718 | DatabaseTimerPersistence.checkDatabase | test | private void checkDatabase() {
String loadTimer = sql(LOAD_TIMER);
Connection connection = null;
Statement statement = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
//test for the existence of the table by running the load timer query
connection = dataSource.getConnection();
if (connection.getTransactionIsolation() < Connection.TRANSACTION_READ_COMMITTED) {
EjbLogger.EJB3_TIMER_LOGGER.wrongTransactionIsolationConfiguredForTimer();
}
preparedStatement = connection.prepareStatement(loadTimer);
preparedStatement.setString(1, "NON-EXISTENT");
preparedStatement.setString(2, "NON-EXISTENT");
preparedStatement.setString(3, "NON-EXISTENT");
resultSet = preparedStatement.executeQuery();
} catch (SQLException e) {
//the query failed, assume it is because the table does not exist
if (connection != null) {
try {
String createTable = sql(CREATE_TABLE);
String[] statements = createTable.split(";");
for (final String sql : statements) {
try {
statement = connection.createStatement();
statement.executeUpdate(sql);
} finally {
safeClose(statement);
}
}
} catch (SQLException e1) {
EjbLogger.EJB3_TIMER_LOGGER.couldNotCreateTable(e1);
}
} else {
EjbLogger.EJB3_TIMER_LOGGER.couldNotCreateTable(e);
}
} finally {
safeClose(resultSet);
safeClose(preparedStatement);
safeClose(statement);
safeClose(connection);
}
} | java | {
"resource": ""
} |
q172719 | DatabaseTimerPersistence.stringAsSchedulerDate | test | private Date stringAsSchedulerDate(final String date, final String timerId) {
if (date == null) {
return null;
}
try {
return new SimpleDateFormat(SCHEDULER_DATE_FORMAT).parse(date);
} catch (ParseException e) {
EjbLogger.EJB3_TIMER_LOGGER.scheduleExpressionDateFromTimerPersistenceInvalid(timerId, e.getMessage());
return null;
}
} | java | {
"resource": ""
} |
q172720 | DatabaseTimerPersistence.setNodeName | test | private void setNodeName(final TimerState timerState, PreparedStatement statement, int paramIndex) throws SQLException {
if(timerState == TimerState.IN_TIMEOUT || timerState == TimerState.RETRY_TIMEOUT) {
statement.setString(paramIndex, nodeName);
} else {
statement.setNull(paramIndex, Types.VARCHAR);
}
} | java | {
"resource": ""
} |
q172721 | WeldDeploymentMarker.mark | test | public static void mark(DeploymentUnit unit) {
unit.putAttachment(MARKER, Boolean.TRUE);
if (unit.getParent() != null) {
mark(unit.getParent());
}
} | java | {
"resource": ""
} |
q172722 | SkeletonStrategy.readParams | test | public Object[] readParams(InputStream in) {
int len = paramReaders.length;
Object[] params = new Object[len];
for (int i = 0; i < len; i++) {
params[i] = paramReaders[i].read(in);
}
return params;
} | java | {
"resource": ""
} |
q172723 | SkeletonStrategy.writeRetval | test | public void writeRetval(OutputStream out, Object retVal) {
retvalWriter.write(out, RemoteObjectSubstitutionManager.writeReplaceRemote(retVal));
} | java | {
"resource": ""
} |
q172724 | SkeletonStrategy.writeException | test | public void writeException(OutputStream out, Throwable e) {
int len = excepWriters.length;
for (int i = 0; i < len; i++) {
if (excepWriters[i].getExceptionClass().isInstance(e)) {
excepWriters[i].write(out, e);
return;
}
}
throw new UnknownException(e);
} | java | {
"resource": ""
} |
q172725 | DefaultBeanInfo.lookup | test | protected <U> U lookup(Lookup<U> lookup, int start, int depth) {
int size;
synchronized (indexes) {
size = indexes.size();
for (int i = start; i < depth && i < size; i++) {
U result = lookup.lookup(indexes.get(i));
if (result != null)
return result;
}
}
if (currentClass == null)
return null;
synchronized (indexes) {
ClassReflectionIndex cri = index.getClassIndex(currentClass);
indexes.add(cri);
currentClass = currentClass.getSuperclass();
}
return lookup(lookup, size, depth);
} | java | {
"resource": ""
} |
q172726 | SFSBCallStack.beginSfsbCreation | test | public static void beginSfsbCreation() {
SFSBCallStackThreadData data = CURRENT.get();
int no = data.creationBeanNestingLevel;
if (no == 0) {
data.creationTimeXPCRegistration = new HashMap<String, ExtendedEntityManager>();
// create new tracking structure (passing in parent levels tracking structure or null if toplevel)
data.creationTimeInjectedXPCs = new SFSBInjectedXPCs(data.creationTimeInjectedXPCs, null);
}
else {
// create new tracking structure (passing in parent levels tracking structure or null if toplevel)
SFSBInjectedXPCs parent = data.creationTimeInjectedXPCs;
data.creationTimeInjectedXPCs = new SFSBInjectedXPCs(parent, parent.getTopLevel());
}
data.creationBeanNestingLevel++;
} | java | {
"resource": ""
} |
q172727 | SFSBCallStack.endSfsbCreation | test | public static void endSfsbCreation() {
SFSBCallStackThreadData data = CURRENT.get();
int no = data.creationBeanNestingLevel;
no--;
data.creationBeanNestingLevel = no;
if (no == 0) {
// Completed creating top level bean, remove 'xpc creation tracking' thread local
data.creationTimeXPCRegistration = null;
data.creationTimeInjectedXPCs = null;
}
else {
// finished creating a sub-bean, switch to parent level 'xpc creation tracking'
data.creationTimeInjectedXPCs = data.creationTimeInjectedXPCs.getParent();
}
} | java | {
"resource": ""
} |
q172728 | SFSBCallStack.currentSFSBCallStackInvocation | test | public static Map<String, ExtendedEntityManager> currentSFSBCallStackInvocation() {
ArrayList<Map<String, ExtendedEntityManager>> stack = CURRENT.get().invocationStack;
if ( stack != null && stack.size() > 0) {
return stack.get(stack.size() - 1);
}
return null;
} | java | {
"resource": ""
} |
q172729 | SFSBCallStack.pushCall | test | public static void pushCall(Map<String, ExtendedEntityManager> entityManagers) {
currentSFSBCallStack().add(entityManagers);
if (entityManagers != null) {
/**
* JPA 2.0 spec section 7.9.1 Container Responsibilities:
* "When a business method of the stateful session bean is invoked,
* if the stateful session bean uses container managed transaction demarcation,
* and the entity manager is not already associated with the current JTA transaction,
* the container associates the entity manager with the current JTA transaction and
* calls EntityManager.joinTransaction.
* "
*/
for(ExtendedEntityManager extendedEntityManager: entityManagers.values()) {
extendedEntityManager.internalAssociateWithJtaTx();
}
}
} | java | {
"resource": ""
} |
q172730 | SFSBCallStack.popCall | test | public static Map<String, ExtendedEntityManager> popCall() {
ArrayList<Map<String, ExtendedEntityManager>> stack = currentSFSBCallStack();
Map<String, ExtendedEntityManager> result = stack.remove(stack.size() - 1);
stack.trimToSize();
return result;
} | java | {
"resource": ""
} |
q172731 | SFSBCallStack.getCurrentCall | test | static Map<String, ExtendedEntityManager> getCurrentCall() {
ArrayList<Map<String, ExtendedEntityManager>> stack = currentSFSBCallStack();
Map<String, ExtendedEntityManager> result = null;
if (stack != null) {
result = stack.get(stack.size() - 1);
}
return result;
} | java | {
"resource": ""
} |
q172732 | WeldDependencyProcessor.deploy | test | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
addDependency(moduleSpecification, moduleLoader, JAVAX_ENTERPRISE_API);
addDependency(moduleSpecification, moduleLoader, JAVAX_INJECT_API);
if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
return; // Skip if there are no beans.xml files in the deployment
}
addDependency(moduleSpecification, moduleLoader, JAVAX_PERSISTENCE_API_ID);
addDependency(moduleSpecification, moduleLoader, WELD_CORE_ID);
addDependency(moduleSpecification, moduleLoader, WELD_PROBE_ID, true);
addDependency(moduleSpecification, moduleLoader, WELD_API_ID);
addDependency(moduleSpecification, moduleLoader, WELD_SPI_ID);
ModuleDependency weldSubsystemDependency = new ModuleDependency(moduleLoader, JBOSS_AS_WELD_ID, false, false, false, false);
weldSubsystemDependency.addImportFilter(PathFilters.getMetaInfFilter(), true);
weldSubsystemDependency.addImportFilter(PathFilters.is("org/jboss/as/weld/injection"), true);
weldSubsystemDependency.addImportFilter(PathFilters.acceptAll(), false);
weldSubsystemDependency.addExportFilter(PathFilters.getMetaInfFilter(), true);
moduleSpecification.addSystemDependency(weldSubsystemDependency);
// Due to serialization of EJBs
ModuleDependency weldEjbDependency = new ModuleDependency(moduleLoader, JBOSS_AS_WELD_EJB_ID, true, false, false, false);
weldEjbDependency.addImportFilter(PathFilters.is("org/jboss/as/weld/ejb"), true);
weldEjbDependency.addImportFilter(PathFilters.acceptAll(), false);
moduleSpecification.addSystemDependency(weldEjbDependency);
} | java | {
"resource": ""
} |
q172733 | JSFComponentProcessor.processXmlManagedBeans | test | private void processXmlManagedBeans(final DeploymentUnit deploymentUnit, final Set<String> managedBeanClasses) {
for (final VirtualFile facesConfig : getConfigurationFiles(deploymentUnit)) {
InputStream is = null;
try {
is = facesConfig.openStream();
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setXMLResolver(NoopXMLResolver.create());
XMLStreamReader parser = inputFactory.createXMLStreamReader(is);
StringBuilder className = null;
int indent = 0;
boolean managedBean = false;
boolean managedBeanClass = false;
while (true) {
int event = parser.next();
if (event == XMLStreamConstants.END_DOCUMENT) {
parser.close();
break;
}
if (event == XMLStreamConstants.START_ELEMENT) {
indent++;
if (indent == 2) {
if (parser.getLocalName().equals(MANAGED_BEAN)) {
managedBean = true;
}
} else if (indent == 3 && managedBean) {
if (parser.getLocalName().equals(MANAGED_BEAN_CLASS)) {
managedBeanClass = true;
className = new StringBuilder();
}
}
} else if (event == XMLStreamConstants.END_ELEMENT) {
indent--;
managedBeanClass = false;
if (indent == 1) {
managedBean = false;
}
if (className != null) {
managedBeanClasses.add(className.toString().trim());
className = null;
}
} else if (managedBeanClass && event == XMLStreamConstants.CHARACTERS) {
className.append(parser.getText());
}
}
} catch (Exception e) {
JSFLogger.ROOT_LOGGER.managedBeansConfigParseFailed(facesConfig);
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
// Ignore
}
}
}
} | java | {
"resource": ""
} |
q172734 | JSFComponentProcessor.processPhaseListeners | test | private void processPhaseListeners(final DeploymentUnit deploymentUnit, final Set<String> managedBeanClasses) {
for (final VirtualFile facesConfig : getConfigurationFiles(deploymentUnit)) {
InputStream is = null;
try {
is = facesConfig.openStream();
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setXMLResolver(NoopXMLResolver.create());
XMLStreamReader parser = inputFactory.createXMLStreamReader(is);
StringBuilder phaseListenerName = null;
int indent = 0;
boolean lifecycle = false;
boolean phaseListener = false;
while (true) {
int event = parser.next();
if (event == XMLStreamConstants.END_DOCUMENT) {
parser.close();
break;
}
if (event == XMLStreamConstants.START_ELEMENT) {
indent++;
if (indent == 2) {
if(parser.getLocalName().equals(LIFECYCLE)){
lifecycle = true;
}
} else if (indent == 3 && lifecycle) {
if(parser.getLocalName().equals(PHASE_LISTENER)){
phaseListener = true;
phaseListenerName = new StringBuilder();
}
}
} else if (event == XMLStreamConstants.END_ELEMENT) {
indent--;
phaseListener = false;
if (indent == 1) {
lifecycle = false;
}
if(phaseListenerName != null){
managedBeanClasses.add(phaseListenerName.toString().trim());
phaseListenerName = null;
}
} else if (phaseListener && event == XMLStreamConstants.CHARACTERS) {
phaseListenerName.append(parser.getText());
}
}
} catch (Exception e) {
JSFLogger.ROOT_LOGGER.phaseListenersConfigParseFailed(facesConfig);
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
// Ignore
}
}
}
} | java | {
"resource": ""
} |
q172735 | Util.getTypeIDLName | test | public static String getTypeIDLName(Class cls)
throws RMIIIOPViolationException {
if (cls.isPrimitive())
return PrimitiveAnalysis.getPrimitiveAnalysis(cls).getIDLName();
if (cls.isArray()) {
// boxedRMI 1.3.6
Class componentClass = cls;
int sequence = 0;
while (componentClass.isArray()) {
componentClass = componentClass.getComponentType();
++sequence;
}
String idlName = getTypeIDLName(componentClass);
int idx = idlName.lastIndexOf("::");
String idlModule = idlName.substring(0, idx + 2);
String baseName = idlName.substring(idx + 2);
return "::org::omg::boxedRMI" + idlModule + "seq" + sequence + "_" + baseName;
}
// special classes
if (cls == java.lang.String.class)
return "::CORBA::WStringValue";
if (cls == java.lang.Object.class)
return "::java::lang::_Object";
if (cls == java.lang.Class.class)
return "::javax::rmi::CORBA::ClassDesc";
if (cls == java.io.Serializable.class)
return "::java::io::Serializable";
if (cls == java.io.Externalizable.class)
return "::java::io::Externalizable";
if (cls == java.rmi.Remote.class)
return "::java::rmi::Remote";
if (cls == org.omg.CORBA.Object.class)
return "::CORBA::Object";
// remote interface?
if (cls.isInterface() && java.rmi.Remote.class.isAssignableFrom(cls)) {
InterfaceAnalysis ia = InterfaceAnalysis.getInterfaceAnalysis(cls);
return ia.getIDLModuleName() + "::" + ia.getIDLName();
}
// IDL interface?
if (cls.isInterface() &&
org.omg.CORBA.Object.class.isAssignableFrom(cls) &&
org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(cls)) {
InterfaceAnalysis ia = InterfaceAnalysis.getInterfaceAnalysis(cls);
return ia.getIDLModuleName() + "::" + ia.getIDLName();
}
// exception?
if (Throwable.class.isAssignableFrom(cls)) {
if (Exception.class.isAssignableFrom(cls) &&
!RuntimeException.class.isAssignableFrom(cls)) {
ExceptionAnalysis ea = ExceptionAnalysis.getExceptionAnalysis(cls);
return ea.getIDLModuleName() + "::" + ea.getIDLName();
}
}
// got to be value
ValueAnalysis va = ValueAnalysis.getValueAnalysis(cls);
return va.getIDLModuleName() + "::" + va.getIDLName();
} | java | {
"resource": ""
} |
q172736 | Util.insertAnyPrimitive | test | public static void insertAnyPrimitive(Any any, Object primitive) {
Class type = primitive.getClass();
if (type == Boolean.class)
any.insert_boolean(((Boolean) primitive).booleanValue());
else if (type == Character.class)
any.insert_wchar(((Character) primitive).charValue());
else if (type == Byte.class)
any.insert_octet(((Byte) primitive).byteValue());
else if (type == Short.class)
any.insert_short(((Short) primitive).shortValue());
else if (type == Integer.class)
any.insert_long(((Integer) primitive).intValue());
else if (type == Long.class)
any.insert_longlong(((Long) primitive).longValue());
else if (type == Float.class)
any.insert_float(((Float) primitive).floatValue());
else if (type == Double.class)
any.insert_double(((Double) primitive).doubleValue());
else
throw IIOPLogger.ROOT_LOGGER.notAPrimitive(type.getName());
} | java | {
"resource": ""
} |
q172737 | Util.javaToIDLName | test | public static String javaToIDLName(String name) {
if (name == null || "".equals(name) || name.indexOf('.') != -1)
throw IIOPLogger.ROOT_LOGGER.nameCannotBeNullEmptyOrQualified();
StringBuffer res = new StringBuffer(name.length());
if (name.charAt(0) == '_')
res.append('J'); // 1.3.2.3
for (int i = 0; i < name.length(); ++i) {
char c = name.charAt(i);
if (isLegalIDLIdentifierChar(c))
res.append(c);
else // 1.3.2.4
res.append('U').append(toHexString((int) c));
}
String s = res.toString();
if (isReservedIDLKeyword(s))
return "_" + s;
else
return s;
} | java | {
"resource": ""
} |
q172738 | Util.isReservedIDLKeyword | test | private static boolean isReservedIDLKeyword(String s) {
// TODO: faster lookup
for (int i = 0; i < reservedIDLKeywords.length; ++i)
if (reservedIDLKeywords[i].equals(s))
return true;
return false;
} | java | {
"resource": ""
} |
q172739 | Util.getSignature | test | private static String getSignature(Class cls) {
if (cls.isArray())
return "[" + cls.getComponentType();
if (cls.isPrimitive()) {
if (cls == Byte.TYPE)
return "B";
if (cls == Character.TYPE)
return "C";
if (cls == Double.TYPE)
return "D";
if (cls == Float.TYPE)
return "F";
if (cls == Integer.TYPE)
return "I";
if (cls == Long.TYPE)
return "J";
if (cls == Short.TYPE)
return "S";
if (cls == Boolean.TYPE)
return "Z";
throw IIOPLogger.ROOT_LOGGER.unknownPrimitiveType(cls.getName());
}
return "L" + cls.getName().replace('.', '/') + ";";
} | java | {
"resource": ""
} |
q172740 | Util.getSignature | test | private static String getSignature(Method method) {
StringBuffer b = new StringBuffer("(");
Class[] parameterTypes = method.getParameterTypes();
for (int i = 0; i < parameterTypes.length; ++i)
b.append(getSignature(parameterTypes[i]));
b.append(')').append(getSignature(method.getReturnType()));
return b.toString();
} | java | {
"resource": ""
} |
q172741 | Util.primitiveTypeIDLName | test | static String primitiveTypeIDLName(Class type) {
if (type == Void.TYPE)
return "void";
if (type == Boolean.TYPE)
return "boolean";
if (type == Character.TYPE)
return "wchar";
if (type == Byte.TYPE)
return "octet";
if (type == Short.TYPE)
return "short";
if (type == Integer.TYPE)
return "long";
if (type == Long.TYPE)
return "long long";
if (type == Float.TYPE)
return "float";
if (type == Double.TYPE)
return "double";
throw IIOPLogger.ROOT_LOGGER.notAPrimitive(type.getName());
} | java | {
"resource": ""
} |
q172742 | BatchPermission.forName | test | public static BatchPermission forName(final String name) {
Assert.checkNotNullParam("name", name);
return "*".equals(name) ? allPermission : mapping.getItemByString(name);
} | java | {
"resource": ""
} |
q172743 | TransactionScopedEntityManager.getOrCreateTransactionScopedEntityManager | test | private EntityManager getOrCreateTransactionScopedEntityManager(
final EntityManagerFactory emf,
final String scopedPuName,
final Map properties,
final SynchronizationType synchronizationType) {
EntityManager entityManager = TransactionUtil.getTransactionScopedEntityManager(puScopedName, transactionSynchronizationRegistry);
if (entityManager == null) {
entityManager = createEntityManager(emf, properties, synchronizationType);
if (ROOT_LOGGER.isDebugEnabled()) {
ROOT_LOGGER.debugf("%s: created entity manager session %s", TransactionUtil.getEntityManagerDetails(entityManager, scopedPuName),
TransactionUtil.getTransaction(transactionManager).toString());
}
TransactionUtil.registerSynchronization(entityManager, scopedPuName, transactionSynchronizationRegistry, transactionManager);
TransactionUtil.putEntityManagerInTransactionRegistry(scopedPuName, entityManager, transactionSynchronizationRegistry);
}
else {
testForMixedSynchronizationTypes(emf, entityManager, puScopedName, synchronizationType, properties);
if (ROOT_LOGGER.isDebugEnabled()) {
ROOT_LOGGER.debugf("%s: reuse entity manager session already in tx %s", TransactionUtil.getEntityManagerDetails(entityManager, scopedPuName),
TransactionUtil.getTransaction(transactionManager).toString());
}
}
return entityManager;
} | java | {
"resource": ""
} |
q172744 | ConcurrentReferenceHashMap.put | test | public V put(K key, V value) {
if (value == null)
throw new NullPointerException();
int hash = hashOf(key);
return segmentFor(hash).put(key, hash, value, false);
} | java | {
"resource": ""
} |
q172745 | ManagementUtil.convertSecurityRole | test | static ModelNode convertSecurityRole(final ModelNode camelCase) {
final ModelNode result = new ModelNode();
result.setEmptyList();
if (camelCase.isDefined()) {
for (ModelNode role : camelCase.asList()) {
final ModelNode roleNode = result.add();
for (Property prop : role.asPropertyList()) {
String key = prop.getName();
if ("createDurableQueue".equals(key)) {
key = SecurityRoleDefinition.CREATE_DURABLE_QUEUE.getName();
} else if ("deleteDurableQueue".equals(key)) {
key = SecurityRoleDefinition.DELETE_DURABLE_QUEUE.getName();
} else if ("createNonDurableQueue".equals(key)) {
key = SecurityRoleDefinition.CREATE_NON_DURABLE_QUEUE.getName();
} else if ("deleteNonDurableQueue".equals(key)) {
key = SecurityRoleDefinition.DELETE_NON_DURABLE_QUEUE.getName();
}
roleNode.get(key).set(prop.getValue());
}
}
}
return result;
} | java | {
"resource": ""
} |
q172746 | FileTimerPersistence.mostRecentEntityVersion | test | private TimerImpl mostRecentEntityVersion(final TimerImpl timerImpl) {
try {
final int status = ContextTransactionManager.getInstance().getStatus();
if (status == Status.STATUS_UNKNOWN ||
status == Status.STATUS_NO_TRANSACTION) {
return timerImpl;
}
final String key = timerTransactionKey(timerImpl);
TimerImpl existing = (TimerImpl) transactionSynchronizationRegistry.getValue().getResource(key);
return existing != null ? existing : timerImpl;
} catch (SystemException e) {
throw new RuntimeException(e);
}
} | java | {
"resource": ""
} |
q172747 | FileTimerPersistence.getTimers | test | private Map<String, TimerImpl> getTimers(final String timedObjectId, final TimerServiceImpl timerService) {
return loadTimersFromFile(timedObjectId, timerService);
} | java | {
"resource": ""
} |
q172748 | FileTimerPersistence.getDirectory | test | private String getDirectory(String timedObjectId) {
String dirName = directories.get(timedObjectId);
if (dirName == null) {
dirName = baseDir.getAbsolutePath() + File.separator + timedObjectId.replace(File.separator, "-");
File file = new File(dirName);
if (!file.exists()) {
if (!file.mkdirs()) {
EJB3_TIMER_LOGGER.failToCreateDirectoryForPersistTimers(file);
}
}
directories.put(timedObjectId, dirName);
}
return dirName;
} | java | {
"resource": ""
} |
q172749 | NamingEventCoordinator.addListener | test | synchronized void addListener(final String target, final int scope, final NamingListener namingListener) {
final TargetScope targetScope = new TargetScope(target, scope);
// Do we have a holder for this listener
ListenerHolder holder = holdersByListener.get(namingListener);
if (holder == null) {
holder = new ListenerHolder(namingListener, targetScope);
final Map<NamingListener, ListenerHolder> byListenerCopy = new FastCopyHashMap<NamingListener, ListenerHolder>(holdersByListener);
byListenerCopy.put(namingListener, holder);
holdersByListener = byListenerCopy;
} else {
holder.addTarget(targetScope);
}
List<ListenerHolder> holdersForTarget = holdersByTarget.get(targetScope);
if (holdersForTarget == null) {
holdersForTarget = new CopyOnWriteArrayList<ListenerHolder>();
final Map<TargetScope, List<ListenerHolder>> byTargetCopy = new FastCopyHashMap<TargetScope, List<ListenerHolder>>(holdersByTarget);
byTargetCopy.put(targetScope, holdersForTarget);
holdersByTarget = byTargetCopy;
}
holdersForTarget.add(holder);
} | java | {
"resource": ""
} |
q172750 | NamingEventCoordinator.removeListener | test | synchronized void removeListener(final NamingListener namingListener) {
// Do we have a holder for this listener
final ListenerHolder holder = holdersByListener.get(namingListener);
if (holder == null) {
return;
}
final Map<NamingListener, ListenerHolder> byListenerCopy = new FastCopyHashMap<NamingListener, ListenerHolder>(holdersByListener);
byListenerCopy.remove(namingListener);
holdersByListener = byListenerCopy;
final Map<TargetScope, List<ListenerHolder>> byTargetCopy = new FastCopyHashMap<TargetScope, List<ListenerHolder>>(holdersByTarget);
for (TargetScope targetScope : holder.targets) {
final List<ListenerHolder> holders = holdersByTarget.get(targetScope);
holders.remove(holder);
if (holders.isEmpty()) {
byTargetCopy.remove(targetScope);
}
}
holdersByTarget = byTargetCopy;
} | java | {
"resource": ""
} |
q172751 | NamingEventCoordinator.fireEvent | test | void fireEvent(final EventContext context, final Name name, final Binding existingBinding, final Binding newBinding, int type, final String changeInfo, final Integer... scopes) {
final String target = name.toString();
final Set<Integer> scopeSet = new HashSet<Integer>(Arrays.asList(scopes));
final NamingEvent event = new NamingEvent(context, type, newBinding, existingBinding, changeInfo);
final Set<ListenerHolder> holdersToFire = new HashSet<ListenerHolder>();
// Check for OBJECT_SCOPE based listeners
if (scopeSet.contains(EventContext.OBJECT_SCOPE)) {
final TargetScope targetScope = new TargetScope(target, EventContext.OBJECT_SCOPE);
final List<ListenerHolder> holders = holdersByTarget.get(targetScope);
if (holders != null) {
for (ListenerHolder holder : holders) {
holdersToFire.add(holder);
}
}
}
// Check for ONELEVEL_SCOPE based listeners
if (scopeSet.contains(EventContext.ONELEVEL_SCOPE) && !name.isEmpty()) {
final TargetScope targetScope = new TargetScope(name.getPrefix(name.size() - 1).toString(), EventContext.ONELEVEL_SCOPE);
final List<ListenerHolder> holders = holdersByTarget.get(targetScope);
if (holders != null) {
for (ListenerHolder holder : holders) {
holdersToFire.add(holder);
}
}
}
// Check for SUBTREE_SCOPE based listeners
if (scopeSet.contains(EventContext.SUBTREE_SCOPE) && !name.isEmpty()) {
for (int i = 1; i < name.size(); i++) {
final Name parentName = name.getPrefix(i);
final TargetScope targetScope = new TargetScope(parentName.toString(), EventContext.SUBTREE_SCOPE);
final List<ListenerHolder> holders = holdersByTarget.get(targetScope);
if (holders != null) {
for (ListenerHolder holder : holders) {
holdersToFire.add(holder);
}
}
}
}
executor.execute(new FireEventTask(holdersToFire, event));
} | java | {
"resource": ""
} |
q172752 | Consumers.close | test | public static <T extends AutoCloseable> Consumer<T> close() {
return value -> {
try {
value.close();
} catch (Throwable e) {
ClusteringLogger.ROOT_LOGGER.failedToClose(e, value);
}
};
} | java | {
"resource": ""
} |
q172753 | ElytronSubjectFactory.addPrivateCredential | test | private void addPrivateCredential(final Subject subject, final Object credential) {
if (!WildFlySecurityManager.isChecking()) {
subject.getPrivateCredentials().add(credential);
}
else {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
subject.getPrivateCredentials().add(credential);
return null;
});
}
} | java | {
"resource": ""
} |
q172754 | ObjectFactoryBuilder.getObjectInstance | test | public Object getObjectInstance(final Object ref, final Name name, final Context nameCtx, final Hashtable<?, ?> environment) throws Exception {
final ClassLoader classLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
if (classLoader == null) {
return ref;
}
final String factoriesProp = (String) environment.get(Context.OBJECT_FACTORIES);
if (factoriesProp != null) {
final String[] classes = factoriesProp.split(":");
for (String className : classes) {
try {
final Class<?> factoryClass = classLoader.loadClass(className);
final ObjectFactory objectFactory = ObjectFactory.class.cast(factoryClass.newInstance());
final Object result = objectFactory.getObjectInstance(ref, name, nameCtx, environment);
if (result != null) {
return result;
}
} catch (Throwable ignored) {
}
}
}
return ref;
} | java | {
"resource": ""
} |
q172755 | SessionBeanComponentDescription.addTxManagementInterceptorForView | test | protected static void addTxManagementInterceptorForView(ViewDescription view) {
// add a Tx configurator
view.getConfigurators().add(new ViewConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException {
EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentConfiguration.getComponentDescription();
// Add CMT interceptor factory
if (TransactionManagementType.CONTAINER.equals(ejbComponentDescription.getTransactionManagementType())) {
configuration.addViewInterceptor(CMTTxInterceptor.FACTORY, InterceptorOrder.View.CMT_TRANSACTION_INTERCEPTOR);
}
}
});
} | java | {
"resource": ""
} |
q172756 | QueryName.subst | test | private static void subst(final StringBuilder stringBuilder, final String from, final String to) {
int begin = 0, end = 0;
while ((end = stringBuilder.indexOf(from, end)) != -1) {
stringBuilder.delete(end, end + from.length());
stringBuilder.insert(end, to);
// update positions
begin = end + to.length();
end = begin;
}
} | java | {
"resource": ""
} |
q172757 | ImportJournalOperation.createInVMTransportConfiguration | test | private TransportConfiguration createInVMTransportConfiguration(OperationContext context) throws OperationFailedException {
final Resource serverResource = context.readResource(EMPTY_ADDRESS, false);
Set<Resource.ResourceEntry> invmConnectors = serverResource.getChildren(CommonAttributes.IN_VM_CONNECTOR);
if (invmConnectors.isEmpty()) {
throw MessagingLogger.ROOT_LOGGER.noInVMConnector();
}
Resource.ResourceEntry connectorEntry = invmConnectors.iterator().next();
Resource connectorResource = context.readResource(PathAddress.pathAddress(connectorEntry.getPathElement()), false);
ModelNode model = connectorResource.getModel();
Map<String, Object> params = new HashMap<>(CommonAttributes.PARAMS.unwrap(context, model));
params.put(InVMTransportDefinition.SERVER_ID.getName(), InVMTransportDefinition.SERVER_ID.resolveModelAttribute(context, model).asInt());
TransportConfiguration transportConfiguration = new TransportConfiguration(InVMConnectorFactory.class.getName(), params);
return transportConfiguration;
} | java | {
"resource": ""
} |
q172758 | ResourceAdaptorMergingProcessor.addEarPrefixIfRelativeName | test | private String addEarPrefixIfRelativeName(final String configuredName, final DeploymentUnit deploymentUnit,
final Class<?> componentClass) throws DeploymentUnitProcessingException {
if (!configuredName.startsWith("#")) {
return configuredName;
}
final DeploymentUnit parent = deploymentUnit.getParent();
if (parent == null) {
throw EjbLogger.ROOT_LOGGER.relativeResourceAdapterNameInStandaloneModule(deploymentUnit.getName(),
componentClass.getName(), configuredName);
}
return new StringBuilder().append(parent.getName()).append(configuredName).toString();
} | java | {
"resource": ""
} |
q172759 | Utils.getRootDeploymentUnit | test | public static DeploymentUnit getRootDeploymentUnit(DeploymentUnit deploymentUnit) {
if (deploymentUnit.getParent() == null) {
return deploymentUnit;
}
return deploymentUnit.getParent();
} | java | {
"resource": ""
} |
q172760 | ViewDescription.getServiceName | test | public ServiceName getServiceName() {
//TODO: need to set viewNameParts somewhere
if (!viewNameParts.isEmpty()) {
return componentDescription.getServiceName().append("VIEW").append(viewNameParts.toArray(new String[viewNameParts.size()]));
} else {
return componentDescription.getServiceName().append("VIEW").append(viewClassName);
}
} | java | {
"resource": ""
} |
q172761 | ViewDescription.createViewConfiguration | test | public ViewConfiguration createViewConfiguration(final Class<?> viewClass, final ComponentConfiguration componentConfiguration, final ProxyFactory<?> proxyFactory) {
return new ViewConfiguration(viewClass, componentConfiguration, getServiceName(), proxyFactory);
} | java | {
"resource": ""
} |
q172762 | ViewDescription.createInjectionSource | test | protected InjectionSource createInjectionSource(final ServiceName serviceName, Value<ClassLoader> viewClassLoader, boolean appclient) {
return new ViewBindingInjectionSource(serviceName);
} | java | {
"resource": ""
} |
q172763 | ViewConfiguration.getViewInterceptors | test | public List<InterceptorFactory> getViewInterceptors(Method method) {
OrderedItemContainer<InterceptorFactory> container = viewInterceptors.get(method);
if (container == null) {
return Collections.emptyList();
}
return container.getSortedItems();
} | java | {
"resource": ""
} |
q172764 | ViewConfiguration.addViewInterceptor | test | public void addViewInterceptor(InterceptorFactory interceptorFactory, int priority) {
for (Method method : proxyFactory.getCachedMethods()) {
addViewInterceptor(method, interceptorFactory, priority);
}
} | java | {
"resource": ""
} |
q172765 | ViewConfiguration.addViewInterceptor | test | public void addViewInterceptor(Method method, InterceptorFactory interceptorFactory, int priority) {
OrderedItemContainer<InterceptorFactory> container = viewInterceptors.get(method);
if (container == null) {
viewInterceptors.put(method, container = new OrderedItemContainer<InterceptorFactory>());
}
container.add(interceptorFactory, priority);
} | java | {
"resource": ""
} |
q172766 | ViewConfiguration.getClientInterceptors | test | public List<InterceptorFactory> getClientInterceptors(Method method) {
OrderedItemContainer<InterceptorFactory> container = clientInterceptors.get(method);
if (container == null) {
return Collections.emptyList();
}
return container.getSortedItems();
} | java | {
"resource": ""
} |
q172767 | ViewConfiguration.addClientInterceptor | test | public void addClientInterceptor(InterceptorFactory interceptorFactory, int priority) {
for (Method method : proxyFactory.getCachedMethods()) {
addClientInterceptor(method, interceptorFactory, priority);
}
} | java | {
"resource": ""
} |
q172768 | ViewConfiguration.addClientInterceptor | test | public void addClientInterceptor(Method method, InterceptorFactory interceptorFactory, int priority) {
OrderedItemContainer<InterceptorFactory> container = clientInterceptors.get(method);
if (container == null) {
clientInterceptors.put(method, container = new OrderedItemContainer<InterceptorFactory>());
}
container.add(interceptorFactory, priority);
} | java | {
"resource": ""
} |
q172769 | ViewConfiguration.putPrivateData | test | public <T> void putPrivateData(final Class<T> type, T data ) {
privateData.put(type, data);
} | java | {
"resource": ""
} |
q172770 | EJBClientDescriptor10Parser.unexpectedElement | test | protected static void unexpectedElement(final XMLExtendedStreamReader reader) throws XMLStreamException {
throw EeLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), reader.getLocation());
} | java | {
"resource": ""
} |
q172771 | ASHelper.getJaxwsEjbs | test | public static List<EJBEndpoint> getJaxwsEjbs(final DeploymentUnit unit) {
final JAXWSDeployment jaxwsDeployment = getOptionalAttachment(unit, WSAttachmentKeys.JAXWS_ENDPOINTS_KEY);
return jaxwsDeployment != null ? jaxwsDeployment.getEjbEndpoints() : Collections.<EJBEndpoint>emptyList();
} | java | {
"resource": ""
} |
q172772 | ASHelper.getJaxwsPojos | test | public static List<POJOEndpoint> getJaxwsPojos(final DeploymentUnit unit) {
final JAXWSDeployment jaxwsDeployment = unit.getAttachment(WSAttachmentKeys.JAXWS_ENDPOINTS_KEY);
return jaxwsDeployment != null ? jaxwsDeployment.getPojoEndpoints() : Collections.<POJOEndpoint>emptyList();
} | java | {
"resource": ""
} |
q172773 | ASHelper.getEndpointName | test | public static String getEndpointName(final ServletMetaData servletMD) {
final String endpointName = servletMD.getName();
return endpointName != null ? endpointName.trim() : null;
} | java | {
"resource": ""
} |
q172774 | ASHelper.getEndpointClassName | test | public static String getEndpointClassName(final ServletMetaData servletMD) {
final String endpointClass = servletMD.getServletClass();
return endpointClass != null ? endpointClass.trim() : null;
} | java | {
"resource": ""
} |
q172775 | ASHelper.getServletForName | test | public static ServletMetaData getServletForName(final JBossWebMetaData jbossWebMD, final String servletName) {
for (JBossServletMetaData servlet : jbossWebMD.getServlets()) {
if (servlet.getName().equals(servletName)) {
return servlet;
}
}
return null;
} | java | {
"resource": ""
} |
q172776 | ASHelper.getRequiredAttachment | test | public static <A> A getRequiredAttachment(final DeploymentUnit unit, final AttachmentKey<A> key) {
final A value = unit.getAttachment(key);
if (value == null) {
throw new IllegalStateException();
}
return value;
} | java | {
"resource": ""
} |
q172777 | ASHelper.getOptionalAttachment | test | public static <A> A getOptionalAttachment(final DeploymentUnit unit, final AttachmentKey<A> key) {
return unit.getAttachment(key);
} | java | {
"resource": ""
} |
q172778 | ASHelper.getJBossWebMetaData | test | public static JBossWebMetaData getJBossWebMetaData(final DeploymentUnit unit) {
final WarMetaData warMetaData = getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
JBossWebMetaData result = null;
if (warMetaData != null) {
result = warMetaData.getMergedJBossWebMetaData();
if (result == null) {
result = warMetaData.getJBossWebMetaData();
}
} else {
result = getOptionalAttachment(unit, WSAttachmentKeys.JBOSSWEB_METADATA_KEY);
}
return result;
} | java | {
"resource": ""
} |
q172779 | ASHelper.getJBossWebserviceMetaDataPortComponent | test | public static JBossPortComponentMetaData getJBossWebserviceMetaDataPortComponent(
final DeploymentUnit unit, final String name) {
if (name != null) {
final JBossWebservicesMetaData jbossWebserviceMetaData = unit.getAttachment(JBOSS_WEBSERVICES_METADATA_KEY);
if (jbossWebserviceMetaData != null) {
JBossPortComponentMetaData[] portComponent = jbossWebserviceMetaData.getPortComponents();
if (portComponent != null) {
for (JBossPortComponentMetaData component : portComponent) {
if (name.equals(component.getEjbName())) {
return component;
}
}
}
}
}
return null;
} | java | {
"resource": ""
} |
q172780 | ASHelper.getWebserviceMetadataEJBEndpoint | test | public static EJBEndpoint getWebserviceMetadataEJBEndpoint(final JAXWSDeployment jaxwsDeployment,
final String className) {
java.util.List<EJBEndpoint> ejbEndpointList = jaxwsDeployment.getEjbEndpoints();
for (EJBEndpoint ejbEndpoint : ejbEndpointList) {
if (className.equals(ejbEndpoint.getClassName())) {
return ejbEndpoint;
}
}
return null;
} | java | {
"resource": ""
} |
q172781 | ASHelper.getContextRoot | test | public static String getContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD) {
final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
final JBossAppMetaData jbossAppMD = unit.getParent() == null ? null : ASHelper.getOptionalAttachment(unit.getParent(),
WSAttachmentKeys.JBOSS_APP_METADATA_KEY);
String contextRoot = null;
// prefer context root defined in application.xml over one defined in jboss-web.xml
if (jbossAppMD != null) {
final ModuleMetaData moduleMD = jbossAppMD.getModules().get(dep.getSimpleName());
if (moduleMD != null) {
final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
contextRoot = webModuleMD.getContextRoot();
}
}
if (contextRoot == null) {
contextRoot = jbossWebMD != null ? jbossWebMD.getContextRoot() : null;
}
return contextRoot;
} | java | {
"resource": ""
} |
q172782 | WeldModuleResourceLoader.classForName | test | @Override
public Class<?> classForName(String name) {
try {
if (classes.containsKey(name)) {
return classes.get(name);
}
final Class<?> clazz = module.getClassLoader().loadClass(name);
classes.put(name, clazz);
return clazz;
} catch (ClassNotFoundException | LinkageError e) {
throw new ResourceLoadingException(e);
}
} | java | {
"resource": ""
} |
q172783 | WeldModuleResourceLoader.getResource | test | @Override
public URL getResource(String name) {
try {
return module.getClassLoader().getResource(name);
} catch (Exception e) {
throw new ResourceLoadingException(e);
}
} | java | {
"resource": ""
} |
q172784 | WeldModuleResourceLoader.getResources | test | @Override
public Collection<URL> getResources(String name) {
try {
final HashSet<URL> resources = new HashSet<URL>();
Enumeration<URL> urls = module.getClassLoader().getResources(name);
while (urls.hasMoreElements()) {
resources.add(urls.nextElement());
}
return resources;
} catch (Exception e) {
throw new ResourceLoadingException(e);
}
} | java | {
"resource": ""
} |
q172785 | ServletResourceManager.list | test | public List<Resource> list(String path) {
try {
final List<Resource> ret = new ArrayList<>();
Resource res = deploymentResourceManager.getResource(path);
if (res != null) {
for (Resource child : res.list()) {
ret.add(new ServletResource(this, child));
}
}
String p = path;
if (p.startsWith("/")) {
p = p.substring(1);
}
if (overlays != null) {
for (VirtualFile overlay : overlays) {
VirtualFile child = overlay.getChild(p);
if (child.exists()) {
VirtualFileResource vfsResource = new VirtualFileResource(overlay.getPhysicalFile(), child, path);
for (Resource c : vfsResource.list()) {
ret.add(new ServletResource(this, c));
}
}
}
}
return ret;
} catch (IOException e) {
throw new RuntimeException(e); //this method really should have thrown IOException
}
} | java | {
"resource": ""
} |
q172786 | NonTxEmCloser.popCall | test | public static void popCall() {
Map<String, EntityManager> emStack = nonTxStack.pop();
if (emStack != null) {
for (EntityManager entityManager : emStack.values()) {
try {
if (entityManager.isOpen()) {
entityManager.close();
}
} catch (RuntimeException safeToIgnore) {
if (ROOT_LOGGER.isTraceEnabled()) {
ROOT_LOGGER.trace("Could not close (non-transactional) container managed entity manager." +
" This shouldn't impact application functionality (only read " +
"operations occur in non-transactional mode)", safeToIgnore);
}
}
}
}
} | java | {
"resource": ""
} |
q172787 | NonTxEmCloser.get | test | public static EntityManager get(String puScopedName) {
Map<String, EntityManager> map = nonTxStack.peek();
if (map != null) {
return map.get(puScopedName);
}
return null;
} | java | {
"resource": ""
} |
q172788 | TransactedJMSContext.registerCleanUpListener | test | void registerCleanUpListener(TransactionSynchronizationRegistry transactionSynchronizationRegistry, JMSContext contextInstance) {
//to avoid registration of more listeners for one context, flag in transaction is used.
Object alreadyRegistered = transactionSynchronizationRegistry.getResource(contextInstance);
if (alreadyRegistered == null) {
transactionSynchronizationRegistry.registerInterposedSynchronization(new AfterCompletionSynchronization(contextInstance));
transactionSynchronizationRegistry.putResource(contextInstance, AfterCompletionSynchronization.class.getName());
}
} | java | {
"resource": ""
} |
q172789 | WarAnnotationDeploymentProcessor.deploy | test | public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
return; // Skip non web deployments
}
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
assert warMetaData != null;
Map<String, WebMetaData> annotationsMetaData = warMetaData.getAnnotationsMetaData();
if (annotationsMetaData == null) {
annotationsMetaData = new HashMap<String, WebMetaData>();
warMetaData.setAnnotationsMetaData(annotationsMetaData);
}
Map<ResourceRoot, Index> indexes = AnnotationIndexUtils.getAnnotationIndexes(deploymentUnit);
// Process lib/*.jar
for (final Entry<ResourceRoot, Index> entry : indexes.entrySet()) {
final Index jarIndex = entry.getValue();
annotationsMetaData.put(entry.getKey().getRootName(), processAnnotations(jarIndex));
}
Map<ModuleIdentifier, CompositeIndex> additionalModelAnnotations = deploymentUnit.getAttachment(Attachments.ADDITIONAL_ANNOTATION_INDEXES_BY_MODULE);
if (additionalModelAnnotations != null) {
final List<WebMetaData> additional = new ArrayList<WebMetaData>();
for (Entry<ModuleIdentifier, CompositeIndex> entry : additionalModelAnnotations.entrySet()) {
for(Index index : entry.getValue().getIndexes()) {
additional.add(processAnnotations(index));
}
}
warMetaData.setAdditionalModuleAnnotationsMetadata(additional);
}
} | java | {
"resource": ""
} |
q172790 | WSServerConfigAttributeHandler.updateServerConfig | test | private boolean updateServerConfig(String attributeName, String value, boolean isRevert) throws OperationFailedException, DisabledOperationException {
final ServerConfigImpl config = (ServerConfigImpl) ServerConfigFactoryImpl.getConfig();
try {
if (MODIFY_WSDL_ADDRESS.equals(attributeName)) {
final boolean modifyWSDLAddress = value != null && Boolean.parseBoolean(value);
config.setModifySOAPAddress(modifyWSDLAddress, isRevert);
} else if (WSDL_HOST.equals(attributeName)) {
final String host = value != null ? value : null;
try {
config.setWebServiceHost(host, isRevert);
} catch (final UnknownHostException e) {
throw new OperationFailedException(e.getMessage(), e);
}
} else if (WSDL_PORT.equals(attributeName)) {
final int port = value != null ? Integer.parseInt(value) : -1;
config.setWebServicePort(port, isRevert);
} else if (WSDL_SECURE_PORT.equals(attributeName)) {
final int securePort = value != null ? Integer.parseInt(value) : -1;
config.setWebServiceSecurePort(securePort, isRevert);
} else if (WSDL_PATH_REWRITE_RULE.equals(attributeName)) {
final String path = value != null ? value : null;
config.setWebServicePathRewriteRule(path, isRevert);
} else if (WSDL_URI_SCHEME.equals(attributeName)) {
if (value == null || value.equals("http") || value.equals("https")) {
config.setWebServiceUriScheme(value, isRevert);
} else {
throw new IllegalArgumentException(attributeName + " = " + value);
}
} else if (STATISTICS_ENABLED.equals(attributeName)) {
final boolean enabled = value != null ? Boolean.parseBoolean(value) : false;
config.setStatisticsEnabled(enabled);
} else {
throw new IllegalArgumentException(attributeName);
}
} catch (DisabledOperationException doe) {
// the WS stack rejected the runtime update
if (!isRevert) {
return false;
} else {
throw doe;
}
}
return true;
} | java | {
"resource": ""
} |
q172791 | RmiIdlUtil.isAllFieldsPublic | test | public static boolean isAllFieldsPublic(Class c) {
try {
final Field[] list = c.getFields();
for (int i = 0; i < list.length; i++)
if (!Modifier.isPublic(list[i].getModifiers()))
return false;
} catch (Exception e) {
return false;
}
return true;
} | java | {
"resource": ""
} |
q172792 | AbstractDeploymentModelBuilder.newHttpEndpoint | test | protected final Endpoint newHttpEndpoint(final String endpointClass, final String endpointName, final Deployment dep) {
if (endpointName == null) throw WSLogger.ROOT_LOGGER.nullEndpointName();
if (endpointClass == null) throw WSLogger.ROOT_LOGGER.nullEndpointClass();
final Endpoint endpoint = this.deploymentModelFactory.newHttpEndpoint(endpointClass);
endpoint.setShortName(endpointName);
endpoint.setType(endpointType);
dep.getService().addEndpoint(endpoint);
return endpoint;
} | java | {
"resource": ""
} |
q172793 | AbstractDeploymentModelBuilder.newDeployment | test | private ArchiveDeployment newDeployment(final DeploymentUnit unit) {
WSLogger.ROOT_LOGGER.tracef("Creating new unified WS deployment model for %s", unit);
final ResourceRoot deploymentRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile root = deploymentRoot != null ? deploymentRoot.getRoot() : null;
final ClassLoader classLoader;
final Module module = unit.getAttachment(Attachments.MODULE);
if (module == null) {
classLoader = unit.getAttachment(CLASSLOADER_KEY);
if (classLoader == null) {
throw WSLogger.ROOT_LOGGER.classLoaderResolutionFailed(unit);
}
} else {
classLoader = module.getClassLoader();
}
ArchiveDeployment parentDep = null;
if (unit.getParent() != null) {
final Module parentModule = unit.getParent().getAttachment(Attachments.MODULE);
if (parentModule == null) {
throw WSLogger.ROOT_LOGGER.classLoaderResolutionFailed(deploymentRoot);
}
WSLogger.ROOT_LOGGER.tracef("Creating new unified WS deployment model for %s", unit.getParent());
parentDep = this.newDeployment(null, unit.getParent().getName(), parentModule.getClassLoader(), null);
}
final UnifiedVirtualFile uvf = root != null ? new VirtualFileAdaptor(root) : new ResourceLoaderAdapter(classLoader);
final ArchiveDeployment dep = this.newDeployment(parentDep, unit.getName(), classLoader, uvf);
//add an AnnotationInfo attachment that uses composite jandex index
dep.addAttachment(AnnotationsInfo.class, new JandexAnnotationsInfo(unit));
return dep;
} | java | {
"resource": ""
} |
q172794 | JaxrsDeploymentMarker.isJaxrsDeployment | test | public static boolean isJaxrsDeployment(DeploymentUnit deploymentUnit) {
DeploymentUnit deployment = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
Boolean val = deployment.getAttachment(ATTACHMENT_KEY);
return val != null && val;
} | java | {
"resource": ""
} |
q172795 | TimerImpl.setNextTimeout | test | public void setNextTimeout(Date next) {
if(next == null) {
setTimerState(TimerState.EXPIRED, null);
}
this.nextExpiration = next;
} | java | {
"resource": ""
} |
q172796 | TimerImpl.setTimerState | test | protected void setTimerState(TimerState state, Thread thread) {
assert ((state == TimerState.IN_TIMEOUT || state == TimerState.RETRY_TIMEOUT) && thread != null) || thread == null : "Invalid to set timer state " + state + " with executing Thread " + thread;
this.timerState = state;
this.executingThread = thread;
} | java | {
"resource": ""
} |
q172797 | ResteasyDeploymentData.merge | test | public void merge(final List<ResteasyDeploymentData> deploymentData) throws DeploymentUnitProcessingException {
for (ResteasyDeploymentData data : deploymentData) {
scannedApplicationClasses.addAll(data.getScannedApplicationClasses());
if (scanResources) {
scannedResourceClasses.addAll(data.getScannedResourceClasses());
scannedJndiComponentResources.addAll(data.getScannedJndiComponentResources());
}
if (scanProviders) {
scannedProviderClasses.addAll(data.getScannedProviderClasses());
}
}
} | java | {
"resource": ""
} |
q172798 | JavaEEDependencyProcessor.deploy | test | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
//add jboss-invocation classes needed by the proxies
ModuleDependency invocation = new ModuleDependency(moduleLoader, JBOSS_INVOCATION_ID, false, false, false, false);
invocation.addImportFilter(PathFilters.is("org/jboss/invocation/proxy/classloading"), true);
invocation.addImportFilter(PathFilters.acceptAll(), false);
moduleSpecification.addSystemDependency(invocation);
ModuleDependency ee = new ModuleDependency(moduleLoader, JBOSS_AS_EE, false, false, false, false);
ee.addImportFilter(PathFilters.is("org/jboss/as/ee/component/serialization"), true);
ee.addImportFilter(PathFilters.is("org/jboss/as/ee/concurrent"), true);
ee.addImportFilter(PathFilters.is("org/jboss/as/ee/concurrent/handle"), true);
ee.addImportFilter(PathFilters.acceptAll(), false);
moduleSpecification.addSystemDependency(ee);
// add dep for naming permission
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(WILDFLY_NAMING), false, false, false, false));
//we always add all Java EE API modules, as the platform spec requires them to always be available
//we do not just add the javaee.api module, as this breaks excludes
for (final ModuleIdentifier moduleIdentifier : JAVA_EE_API_MODULES) {
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, true, false, true, false));
}
} | java | {
"resource": ""
} |
q172799 | EJBComponentDescription.addRemoteTransactionsDependency | test | protected void addRemoteTransactionsDependency() {
this.getConfigurators().add(new ComponentConfigurator() {
@Override
public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration componentConfiguration) throws DeploymentUnitProcessingException {
if (this.hasRemoteView((EJBComponentDescription) description)) {
// add a dependency on local transaction service
componentConfiguration.getCreateDependencies().add((sb, cs) -> sb.requires(TxnServices.JBOSS_TXN_REMOTE_TRANSACTION_SERVICE));
}
}
/**
* Returns true if the passed EJB component description has at least one remote view
* @param ejbComponentDescription
* @return
*/
private boolean hasRemoteView(final EJBComponentDescription ejbComponentDescription) {
final Set<ViewDescription> views = ejbComponentDescription.getViews();
for (final ViewDescription view : views) {
if (!(view instanceof EJBViewDescription)) {
continue;
}
final MethodIntf viewType = ((EJBViewDescription) view).getMethodIntf();
if (viewType == MethodIntf.REMOTE || viewType == MethodIntf.HOME) {
return true;
}
}
return false;
}
});
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.