_id
stringlengths 2
7
| title
stringlengths 3
140
| partition
stringclasses 3
values | text
stringlengths 73
34.1k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q177100
|
ComponentRepositoryImpl.getReferringComponents
|
test
|
public Set<SleeComponent> getReferringComponents(SleeComponent component) {
Set<SleeComponent> result = new HashSet<SleeComponent>();
for (EventTypeComponent otherComponent : eventTypeComponents.values()) {
if (!otherComponent.getComponentID().equals(
component.getComponentID())) {
if (otherComponent.getDependenciesSet().contains(
component.getComponentID())) {
result.add(otherComponent);
}
}
}
for (LibraryComponent otherComponent : libraryComponents.values()) {
if (!otherComponent.getComponentID().equals(
component.getComponentID())) {
if (otherComponent.getDependenciesSet().contains(
component.getComponentID())) {
result.add(otherComponent);
}
}
}
for (ProfileSpecificationComponent otherComponent : profileSpecificationComponents
.values()) {
if (!otherComponent.getComponentID().equals(
component.getComponentID())) {
if (otherComponent.getDependenciesSet().contains(
component.getComponentID())) {
result.add(otherComponent);
}
}
}
for (ResourceAdaptorComponent otherComponent : resourceAdaptorComponents
.values()) {
if (!otherComponent.getComponentID().equals(
component.getComponentID())) {
if (otherComponent.getDependenciesSet().contains(
component.getComponentID())) {
result.add(otherComponent);
}
}
}
for (ResourceAdaptorTypeComponent otherComponent : resourceAdaptorTypeComponents
.values()) {
if (!otherComponent.getComponentID().equals(
component.getComponentID())) {
if (otherComponent.getDependenciesSet().contains(
component.getComponentID())) {
result.add(otherComponent);
}
}
}
for (SbbComponent otherComponent : sbbComponents.values()) {
if (!otherComponent.getComponentID().equals(
component.getComponentID())) {
if (otherComponent.getDependenciesSet().contains(
component.getComponentID())) {
result.add(otherComponent);
}
}
}
for (ServiceComponent otherComponent : serviceComponents.values()) {
if (!otherComponent.getComponentID().equals(
component.getComponentID())) {
if (otherComponent.getDependenciesSet().contains(
component.getComponentID())) {
result.add(otherComponent);
}
}
}
return result;
}
|
java
|
{
"resource": ""
}
|
q177101
|
SbbEntityFactoryCacheData.getSbbEntities
|
test
|
public Set<SbbEntityID> getSbbEntities() {
final Node node = getNode();
if (node == null) {
return Collections.emptySet();
}
HashSet<SbbEntityID> result = new HashSet<SbbEntityID>();
ServiceID serviceID = null;
for (Object obj : node.getChildrenNames()) {
serviceID = (ServiceID) obj;
for (SbbEntityID sbbEntityID : getRootSbbEntityIDs(serviceID)) {
result.add(sbbEntityID);
collectSbbEntities(sbbEntityID,result);
}
}
return result;
}
|
java
|
{
"resource": ""
}
|
q177102
|
PolicyFileImpl.getPermissions
|
test
|
private Permissions getPermissions(Permissions permissions, final CodeSource cs, Principal[] principals) {
List<PolicyHolderEntry> entries = this.currentPolicy.get().policyHolderEntries;
for (PolicyHolderEntry phe : entries) {
// general
selectPermissions(permissions, cs, principals, phe);
// FIXME: certs?
}
return permissions;
}
|
java
|
{
"resource": ""
}
|
q177103
|
PolicyFileImpl.getCodeSources
|
test
|
public String getCodeSources() {
List<String> css = new ArrayList<String>();
for (PolicyHolderEntry phe : this.currentPolicy.get().policyHolderEntries) {
css.add(phe.getCodeSource().getLocation() == null ? "default" : phe.getCodeSource().getLocation().toString());
}
return Arrays.toString(css.toArray());
}
|
java
|
{
"resource": ""
}
|
q177104
|
ProfileTableImpl.profileExists
|
test
|
public boolean profileExists(String profileName) {
boolean result = component.getProfileEntityFramework().findProfile(this.getProfileTableName(), profileName) != null;
if (logger.isDebugEnabled()) {
logger.debug("Profile named "+profileName+(result ? "" : " does not")+" exists on table named " + this.getProfileTableName());
}
return result;
}
|
java
|
{
"resource": ""
}
|
q177105
|
ProfileTableImpl.remove
|
test
|
public void remove(boolean isUninstall) throws SLEEException {
if (logger.isTraceEnabled()) {
logger.trace("removeProfileTable: removing profileTable="
+ profileTableName);
}
// remove the table profiles, at this stage they may use notification source, lets leave it.
for (ProfileID profileID : getProfiles()) {
// don't invoke the profile concrete object, to avoid evil profile lifecycle impls
// that rollbacks tx, as Test1110251Test
this.removeProfile(profileID.getProfileName(), false, isUninstall);
}
// remove default profile
if (getDefaultProfileEntity() != null) {
this.removeProfile(null, false, false);
}
// add action after commit to remove tracer and close uncommitted mbeans
TransactionalAction commitAction = new TransactionalAction() {
public void execute() {
// remove notification sources for profile table
final TraceManagement traceMBeanImpl = sleeContainer.getTraceManagement();
traceMBeanImpl.deregisterNotificationSource(new ProfileTableNotification(profileTableName));
// close uncommitted mbeans
closeUncommittedProfileMBeans();
}
};
sleeContainer.getTransactionManager().getTransactionContext().getAfterCommitActions().add(commitAction);
if (sleeContainer.getSleeState() == SleeState.RUNNING) {
endActivity();
}
// unregister mbean
unregisterUsageMBean();
// remove object pool
profileManagement.getObjectPoolManagement().removeObjectPool(this, sleeContainer.getTransactionManager());
}
|
java
|
{
"resource": ""
}
|
q177106
|
ResourceAdaptorEntityImpl.updateConfigurationProperties
|
test
|
public void updateConfigurationProperties(ConfigProperties properties)
throws InvalidConfigurationException, InvalidStateException {
if (!component.getDescriptor().getSupportsActiveReconfiguration()
&& (sleeContainer.getSleeState() != SleeState.STOPPED)
&& (state == ResourceAdaptorEntityState.ACTIVE || state == ResourceAdaptorEntityState.STOPPING)) {
throw new InvalidStateException(
"the value of the supports-active-reconfiguration attribute of the resource-adaptor-class element in the deployment descriptor of the Resource Adaptor of the resource adaptor entity is False and the resource adaptor entity is in the Active or Stopping state and the SLEE is in the Starting, Running, or Stopping state");
} else {
object.raConfigurationUpdate(properties);
}
}
|
java
|
{
"resource": ""
}
|
q177107
|
ResourceAdaptorEntityImpl.sleeRunning
|
test
|
@SuppressWarnings({ "unchecked", "rawtypes" })
public void sleeRunning() throws InvalidStateException {
// if entity is active then activate the ra object
if (this.state.isActive()) {
if (setFTContext) {
setFTContext = false;
if (object.isFaultTolerant()) {
// set fault tolerant context, it is a ft ra
try {
this.ftResourceAdaptorContext = new FaultTolerantResourceAdaptorContextImpl(name,sleeContainer,(FaultTolerantResourceAdaptor) object.getResourceAdaptorObject());
object.setFaultTolerantResourceAdaptorContext(ftResourceAdaptorContext);
}
catch (Throwable t) {
logger.error("Got exception invoking setFaultTolerantResourceAdaptorContext(...) for entity "+name, t);
}
}
}
try {
object.raActive();
}
catch (Throwable t) {
logger.error("Got exception invoking raActive() for entity "+name, t);
}
}
}
|
java
|
{
"resource": ""
}
|
q177108
|
ResourceAdaptorEntityImpl.sleeStopping
|
test
|
public void sleeStopping() throws InvalidStateException, TransactionRequiredLocalException {
if (state != null && state.isActive()) {
try {
object.raStopping();
}
catch (Throwable t) {
logger.error("Got exception from RA object",t);
}
scheduleAllActivitiesEnd();
}
}
|
java
|
{
"resource": ""
}
|
q177109
|
ResourceAdaptorEntityImpl.activate
|
test
|
@SuppressWarnings({ "unchecked", "rawtypes" })
public void activate() throws InvalidStateException {
if (!this.state.isInactive()) {
throw new InvalidStateException("entity " + name + " is in state: "
+ this.state);
}
this.state = ResourceAdaptorEntityState.ACTIVE;
// if slee is running then activate ra object
if (sleeContainer.getSleeState() == SleeState.RUNNING) {
if (setFTContext) {
setFTContext = false;
if (object.isFaultTolerant()) {
// set fault tolerant context, it is a ft ra
try {
this.ftResourceAdaptorContext = new FaultTolerantResourceAdaptorContextImpl(name,sleeContainer,(FaultTolerantResourceAdaptor) object.getResourceAdaptorObject());
object.setFaultTolerantResourceAdaptorContext(ftResourceAdaptorContext);
}
catch (Throwable t) {
logger.error("Got exception invoking setFaultTolerantResourceAdaptorContext(...) for entity "+name, t);
}
}
}
try {
object.raActive();
}
catch (Throwable t) {
logger.error("Got exception invoking raActive() for entity "+name, t);
}
}
}
|
java
|
{
"resource": ""
}
|
q177110
|
ResourceAdaptorEntityImpl.deactivate
|
test
|
public void deactivate() throws InvalidStateException, TransactionRequiredLocalException {
if (!this.state.isActive()) {
throw new InvalidStateException("entity " + name + " is in state: "
+ this.state);
}
this.state = ResourceAdaptorEntityState.STOPPING;
if (object.getState() == ResourceAdaptorObjectState.ACTIVE) {
object.raStopping();
}
// tck requires that the method returns with stopping state so do
// all deactivation logic half a sec later
TimerTask t = new TimerTask() {
@Override
public void run() {
try {
cancel();
if (state == ResourceAdaptorEntityState.STOPPING) {
if (object.getState() == ResourceAdaptorObjectState.STOPPING) {
scheduleAllActivitiesEnd();
}
else {
allActivitiesEnded();
}
}
}
catch (Throwable e) {
logger.error(e.getMessage(),e);
}
}
};
resourceAdaptorContext.getTimer().schedule(t,500);
}
|
java
|
{
"resource": ""
}
|
q177111
|
ResourceAdaptorEntityImpl.scheduleAllActivitiesEnd
|
test
|
private void scheduleAllActivitiesEnd() throws TransactionRequiredLocalException {
// schedule the end of all activities if the node is the single member of the cluster
boolean skipActivityEnding = !sleeContainer.getCluster().isSingleMember();
if (!skipActivityEnding && hasActivities()) {
logger.info("RA entity "+name+" activities end scheduled.");
timerTask = new EndAllActivitiesRAEntityTimerTask(this,sleeContainer);
}
else {
allActivitiesEnded();
}
}
|
java
|
{
"resource": ""
}
|
q177112
|
ResourceAdaptorEntityImpl.remove
|
test
|
public void remove() throws InvalidStateException {
if (!this.state.isInactive()) {
throw new InvalidStateException("entity " + name + " is in state: "
+ this.state);
}
object.raUnconfigure();
if (object.isFaultTolerant()) {
object.unsetFaultTolerantResourceAdaptorContext();
ftResourceAdaptorContext.shutdown();
}
object.unsetResourceAdaptorContext();
this.sleeContainer.getTraceManagement()
.deregisterNotificationSource(this.getNotificationSource());
state = null;
}
|
java
|
{
"resource": ""
}
|
q177113
|
ResourceAdaptorEntityImpl.getResourceAdaptorInterface
|
test
|
public Object getResourceAdaptorInterface(ResourceAdaptorTypeID raType) {
return object.getResourceAdaptorInterface(sleeContainer
.getComponentRepository().getComponentByID(raType)
.getDescriptor().getResourceAdaptorInterface());
}
|
java
|
{
"resource": ""
}
|
q177114
|
ResourceAdaptorEntityImpl.serviceActive
|
test
|
public void serviceActive(ServiceID serviceID) {
try {
ReceivableService receivableService = resourceAdaptorContext
.getServiceLookupFacility().getReceivableService(serviceID);
if (receivableService.getReceivableEvents().length > 0) {
object.serviceActive(receivableService);
}
} catch (Throwable e) {
logger.warn("invocation resulted in unchecked exception", e);
}
}
|
java
|
{
"resource": ""
}
|
q177115
|
ResourceAdaptorEntityImpl.derreferActivityHandle
|
test
|
ActivityHandle derreferActivityHandle(ActivityHandle handle) {
ActivityHandle ah = null;
if (resourceManagement.getHandleReferenceFactory() != null && handle.getClass() == ActivityHandleReference.class) {
ActivityHandleReference ahReference = (ActivityHandleReference) handle;
ah = resourceManagement.getHandleReferenceFactory().getActivityHandle(ahReference);
}
else {
ah = handle;
}
return ah;
}
|
java
|
{
"resource": ""
}
|
q177116
|
ResourceAdaptorEntityImpl.activityEnded
|
test
|
public void activityEnded(final ActivityHandle handle, int activityFlags) {
logger.trace("activityEnded( handle = " + handle + " )");
ActivityHandle ah = null;
if (handle instanceof ActivityHandleReference) {
// handle is a ref, derrefer and remove the ref
ah = resourceManagement.getHandleReferenceFactory().removeActivityHandleReference((ActivityHandleReference) handle);
}
else {
// handle is not a reference
ah = handle;
}
if (ah != null && ActivityFlags.hasRequestEndedCallback(activityFlags)) {
object.activityEnded(ah);
}
if (object.getState() == ResourceAdaptorObjectState.STOPPING) {
synchronized (this) {
// the ra object is stopping, check if the timer task is still
// needed
if (!hasActivities()) {
if (timerTask != null) {
timerTask.cancel();
}
allActivitiesEnded();
}
}
}
}
|
java
|
{
"resource": ""
}
|
q177117
|
ResourceAdaptorObjectImpl.raConfigurationUpdate
|
test
|
public void raConfigurationUpdate(ConfigProperties properties)
throws InvalidConfigurationException {
if (doTraceLogs) {
logger.trace("raConfigurationUpdate( properties = " + properties
+ " )");
}
verifyConfigProperties(properties);
object.raConfigurationUpdate(configProperties);
}
|
java
|
{
"resource": ""
}
|
q177118
|
ResourceAdaptorObjectImpl.verifyConfigProperties
|
test
|
private void verifyConfigProperties(ConfigProperties newProperties)
throws InvalidConfigurationException {
if (doTraceLogs) {
logger.trace("verifyConfigProperties( newProperties = "
+ newProperties + " )");
}
// merge properties
for (ConfigProperties.Property configProperty : configProperties
.getProperties()) {
if (newProperties.getProperty(configProperty.getName()) == null) {
newProperties.addProperty(configProperty);
}
}
// validate result
for (ConfigProperties.Property entityProperty : newProperties
.getProperties()) {
if (entityProperty.getValue() == null) {
throw new InvalidConfigurationException("the property "
+ entityProperty.getName() + " has null value");
}
}
// validate in ra object
object.raVerifyConfiguration(newProperties);
// ok, switch config
configProperties = newProperties;
}
|
java
|
{
"resource": ""
}
|
q177119
|
ResourceAdaptorObjectImpl.raStopping
|
test
|
public void raStopping() throws InvalidStateException {
if (doTraceLogs) {
logger.trace("raStopping()");
}
if (state == ResourceAdaptorObjectState.ACTIVE) {
state = ResourceAdaptorObjectState.STOPPING;
object.raStopping();
} else {
throw new InvalidStateException("ra object is in state " + state);
}
}
|
java
|
{
"resource": ""
}
|
q177120
|
ResourceAdaptorObjectImpl.raInactive
|
test
|
public void raInactive() throws InvalidStateException {
if (doTraceLogs) {
logger.trace("raInactive()");
}
if (state == ResourceAdaptorObjectState.STOPPING) {
state = ResourceAdaptorObjectState.INACTIVE;
object.raInactive();
} else {
throw new InvalidStateException("ra object is in state " + state);
}
}
|
java
|
{
"resource": ""
}
|
q177121
|
ResourceAdaptorObjectImpl.raUnconfigure
|
test
|
public void raUnconfigure() throws InvalidStateException {
if (doTraceLogs) {
logger.trace("raUnconfigure()");
}
if (state == ResourceAdaptorObjectState.INACTIVE) {
state = ResourceAdaptorObjectState.UNCONFIGURED;
object.raUnconfigure();
} else {
throw new InvalidStateException("ra object is in state " + state);
}
}
|
java
|
{
"resource": ""
}
|
q177122
|
ResourceAdaptorObjectImpl.unsetResourceAdaptorContext
|
test
|
public void unsetResourceAdaptorContext() throws InvalidStateException {
if (doTraceLogs) {
logger.trace("unsetResourceAdaptorContext()");
}
if (state == ResourceAdaptorObjectState.UNCONFIGURED) {
object.unsetResourceAdaptorContext();
state = null;
} else {
throw new InvalidStateException("ra object is in state " + state);
}
}
|
java
|
{
"resource": ""
}
|
q177123
|
ResourceAdaptorObjectImpl.unsetFaultTolerantResourceAdaptorContext
|
test
|
@SuppressWarnings("unchecked")
public void unsetFaultTolerantResourceAdaptorContext()
throws IllegalArgumentException {
if (doTraceLogs) {
logger.trace("unsetFaultTolerantResourceAdaptorContext()");
}
if (isFaultTolerant()) {
((FaultTolerantResourceAdaptor<Serializable, Serializable>) this.object)
.unsetFaultTolerantResourceAdaptorContext();
} else {
throw new IllegalArgumentException(
"RA Object is not fault tolerant!");
}
}
|
java
|
{
"resource": ""
}
|
q177124
|
ProfileSpecificationComponentImpl.buildProfileAttributeMap
|
test
|
private void buildProfileAttributeMap() throws DeploymentException {
HashMap<String, ProfileAttribute> map = new HashMap<String, ProfileAttribute>();
Class<?> cmpInterface = getProfileCmpInterfaceClass();
String attributeGetterMethodPrefix = "get";
for (Method method : cmpInterface.getMethods()) {
if (!method.getDeclaringClass().equals(Object.class) && method.getName().startsWith(attributeGetterMethodPrefix)) {
String attributeName = method.getName().substring(attributeGetterMethodPrefix.length());
switch (attributeName.length()) {
case 0:
throw new DeploymentException("the profile cmp interface class has an invalid attribute getter method name > "+method.getName());
case 1:
attributeName = attributeName.toLowerCase();
break;
default:
attributeName = attributeName.substring(0, 1).toLowerCase() + attributeName.substring(1);
break;
}
ProfileAttributeImpl profileAttribute = null;
try {
profileAttribute = new ProfileAttributeImpl(attributeName,method.getReturnType());
} catch (Throwable e) {
throw new DeploymentException("Invalid profile cmp interface attribute getter method definition ( name = "+attributeName+" , type = "+method.getReturnType()+" )",e);
}
if (isSlee11()) {
for (ProfileCMPFieldDescriptor cmpField : getDescriptor().getProfileCMPInterface().getCmpFields()) {
if (cmpField.getCmpFieldName().equals(attributeName)) {
// TODO add index hints ?
profileAttribute.setUnique(cmpField.isUnique());
}
}
}
else {
for (ProfileIndexDescriptor profileIndex : getDescriptor().getIndexedAttributes()) {
if (profileIndex.getName().equals(attributeName)) {
profileAttribute.setIndex(true);
profileAttribute.setUnique(profileIndex.getUnique());
}
}
}
map.put(attributeName, profileAttribute);
}
}
profileAttributeMap = Collections.unmodifiableMap(map);
}
|
java
|
{
"resource": ""
}
|
q177125
|
EventContextSuspensionHandler.resume
|
test
|
private void resume() {
// create runnable to resume the event context
Runnable runnable = new Runnable() {
public void run() {
if (scheduledFuture == null) {
// already resumed
return;
}
// cancel timer task
scheduledFuture.cancel(false);
scheduledFuture = null;
// send events frozen to event router again, will be processed only after this one ends (this one is already being executed)
for (EventContext ec : barriedEvents) {
ec.getLocalActivityContext().getExecutorService().routeEvent(ec);
}
barriedEvents = null;
// remove barrier on activity event queue
event.getLocalActivityContext().getEventQueueManager().removeBarrier(transaction);
// remove suspension
suspended = false;
// continue routing the event related with this context
event.getLocalActivityContext().getCurrentEventRoutingTask().run();
}
};
// run it using the activity executor service to avoid thread concurrency
event.getLocalActivityContext().getExecutorService().execute(runnable);
}
|
java
|
{
"resource": ""
}
|
q177126
|
ActivityContextFactoryCacheData.getActivityContextHandles
|
test
|
@SuppressWarnings("unchecked")
public Set<ActivityContextHandle> getActivityContextHandles() {
final Node node = getNode();
return node != null ? node.getChildrenNames() : Collections.emptySet();
}
|
java
|
{
"resource": ""
}
|
q177127
|
AbstractUsageMBeanImplParent.remove
|
test
|
public void remove() {
Logger logger = getLogger();
if (logger.isDebugEnabled()) {
logger.debug("Closing " + toString());
}
final MBeanServer mbeanServer = sleeContainer.getMBeanServer();
try {
mbeanServer.unregisterMBean(getObjectName());
} catch (Exception e) {
logger.error("failed to remove " + toString(), e);
}
// remove all usage param
if (logger.isDebugEnabled()) {
logger
.debug("Removing all named usage parameters of "
+ toString());
}
for (String name : usageMBeans.keySet()) {
try {
_removeUsageParameterSet(name,false);
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
// also remove the default
try {
removeUsageParameterSet();
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
|
java
|
{
"resource": ""
}
|
q177128
|
AbstractUsageMBeanImplParent.getUsageMBean
|
test
|
public ObjectName getUsageMBean(String paramSetName)
throws NullPointerException,
UnrecognizedUsageParameterSetNameException, ManagementException {
if (paramSetName == null)
throw new NullPointerException("Sbb usage param set is null");
return _getUsageMBean(paramSetName);
}
|
java
|
{
"resource": ""
}
|
q177129
|
ProfileAbstractClassDecorator.decorateAbstractClass
|
test
|
public boolean decorateAbstractClass() throws DeploymentException {
ClassPool pool = component.getClassPool();
ProfileAbstractClassDescriptor abstractClass = component.getDescriptor().getProfileAbstractClass();
if (abstractClass == null) {
return false;
}
String abstractClassName = abstractClass.getProfileAbstractClassName();
try {
ctClass = pool.get(abstractClassName);
} catch (NotFoundException nfe) {
throw new DeploymentException("Could not find Abstract Class: "
+ abstractClassName, nfe);
}
decorateClassJNDIAddToEnvironmentCalls();
if (isAbstractClassDecorated) {
try {
String deployDir = component.getDeploymentDir().getAbsolutePath();
ctClass.writeFile(deployDir);
ctClass.detach();
// the file on disk is now in sync with the latest in-memory version
if (logger.isDebugEnabled()) {
logger.debug("Modified Abstract Class "
+ ctClass.getName()
+ " generated in the following path "
+ deployDir);
}
} catch (Throwable e) {
throw new SLEEException ( e.getMessage(), e);
} finally {
ctClass.defrost();
}
return true;
}
else {
return false;
}
}
|
java
|
{
"resource": ""
}
|
q177130
|
SbbAbstractMethodHandler.fireEvent
|
test
|
public static void fireEvent(SbbEntity sbbEntity, EventTypeID eventTypeID,
Object eventObject, ActivityContextInterface aci, Address address) {
fireEvent(sbbEntity, eventTypeID, eventObject, aci, address, null);
}
|
java
|
{
"resource": ""
}
|
q177131
|
SbbAbstractMethodHandler.fireEvent
|
test
|
public static void fireEvent(SbbEntity sbbEntity, EventTypeID eventTypeID,
Object eventObject, ActivityContextInterface aci, Address address,
ServiceID serviceID) {
if (sleeContainer.getCongestionControl().refuseFireEvent()) {
throw new SLEEException("congestion control refused event");
}
// JAIN SLEE (TM) specs - Section 8.4.1
// The SBB object must have an assigned SBB entity when it invokes this
// method.
// Otherwise, this method throws a java.lang.IllegalStateException.
if (sbbEntity == null || sbbEntity.getSbbObject() == null
|| sbbEntity.getSbbObject().getState() != SbbObjectState.READY)
throw new IllegalStateException("SbbObject not assigned!");
// JAIN SLEE (TM) specs - Section 8.4.1
// The event ... cannot be null. If ... argument is null, the fire
// event method throws a java.lang.NullPointerException.
if (eventObject == null)
throw new NullPointerException(
"JAIN SLEE (TM) specs - Section 8.4.1: The event ... cannot be null. If ... argument is null, the fire event method throws a java.lang.NullPointerException.");
// JAIN SLEE (TM) specs - Section 8.4.1
// The activity ... cannot be null. If ... argument is null, the fire
// event method throws a java.lang.NullPointerException.
if (aci == null)
throw new NullPointerException(
"JAIN SLEE (TM) specs - Section 8.4.1: The activity ... cannot be null. If ... argument is null, the fire event method throws a java.lang.NullPointerException.");
// JAIN SLEE (TM) specs - Section 8.4.1
// It is a mandatory transactional method (see Section 9.6.1).
final SleeTransactionManager txManager = sleeContainer.getTransactionManager();
txManager.mandateTransaction();
// rebuild the ac from the aci in the 2nd argument of the invoked
// method, check it's state
ActivityContext ac = ((org.mobicents.slee.container.activity.ActivityContextInterface) aci)
.getActivityContext();
if (logger.isTraceEnabled()) {
logger.trace("invoke(): firing event on "
+ ac);
}
// exception not in specs by mandated by
// tests/activities/activitycontext/Test560Test.xml , it's preferable to
// do double check on here than have the aci fire method throwing it and
// the ra slee endpoint having to translate it to activity ending
// exception, it is not common to have custom event firing in sbbs
if (ac.isEnding()) {
throw new IllegalStateException("activity context "
+ ac.getActivityContextHandle() + " is ending");
}
final EventRoutingTransactionData transactionData = txManager.getTransactionContext().getEventRoutingTransactionData();
if (transactionData != null) {
final EventContext eventBeingDelivered = transactionData.getEventBeingDelivered();
if (eventBeingDelivered != null && eventBeingDelivered.getEvent() == eventObject) {
// there is an event being delivered by this tx and it matches the event being fired, lets copy the ref handler
// fire the event
ac.fireEvent(eventTypeID, eventObject, (Address) address, serviceID, eventBeingDelivered);
return;
}
}
// seems it is not a refire
ac.fireEvent(eventTypeID, eventObject, (Address) address, serviceID, null, null, null);
}
|
java
|
{
"resource": ""
}
|
q177132
|
SbbAbstractMethodHandler.getProfileCMPMethod
|
test
|
public static Object getProfileCMPMethod(SbbEntity sbbEntity,
String getProfileCMPMethodName, ProfileID profileID)
throws UnrecognizedProfileTableNameException,
UnrecognizedProfileNameException {
GetProfileCMPMethodDescriptor mGetProfileCMPMethod = sbbEntity.getSbbComponent()
.getDescriptor().getGetProfileCMPMethods().get(
getProfileCMPMethodName);
if (mGetProfileCMPMethod == null)
throw new AbstractMethodError("Profile CMP Method not found");
if (sbbEntity.getSbbObject().getState() != SbbObjectState.READY) {
throw new IllegalStateException(
"Could not invoke getProfileCMP Method, Sbb Object is not in the READY state!");
}
ProfileManagement sleeProfileManager = sleeContainer
.getSleeProfileTableManager();
ProfileTable profileTable = sleeProfileManager.getProfileTable(profileID.getProfileTableName());
if (!profileTable.profileExists(profileID.getProfileName())) {
throw new UnrecognizedProfileNameException(profileID.toString());
}
return profileTable.getProfile(profileID.getProfileName()).getProfileCmpSlee10Wrapper();
}
|
java
|
{
"resource": ""
}
|
q177133
|
SbbAbstractMethodHandler.getSbbUsageParameterSet
|
test
|
public static Object getSbbUsageParameterSet(SbbEntity sbbEntity, String name)
throws UnrecognizedUsageParameterSetNameException {
if (logger.isTraceEnabled()) {
logger.trace("getSbbUsageParameterSet(): serviceId = "
+ sbbEntity.getSbbEntityId().getServiceID() + " , sbbID = "
+ sbbEntity.getSbbId() + " , name = " + name);
}
return getServiceUsageMBeanImpl(sbbEntity.getSbbEntityId().getServiceID())
.getInstalledUsageParameterSet(sbbEntity.getSbbId(), name);
}
|
java
|
{
"resource": ""
}
|
q177134
|
ClassUtils.getAbstractMethodsFromClass
|
test
|
public static Map getAbstractMethodsFromClass(CtClass sbbAbstractClass) {
HashMap abstractMethods = new HashMap();
CtMethod[] methods = sbbAbstractClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
if (Modifier.isAbstract(methods[i].getModifiers())) {
abstractMethods.put(methods[i].getName(), methods[i]);
}
}
return abstractMethods;
}
|
java
|
{
"resource": ""
}
|
q177135
|
ClassUtils.getInterfaceMethodsFromInterface
|
test
|
public static Map getInterfaceMethodsFromInterface(CtClass interfaceClass,
Map exceptMethods) {
HashMap interfaceMethods = new HashMap();
CtMethod[] methods = interfaceClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++)
{
if (exceptMethods.get(methods[i].getName()) == null)
{
ConcreteClassGeneratorUtils.logger.trace(methods[i].getName());
interfaceMethods.put(getMethodKey(methods[i]), methods[i]);
}
}
Map temp = getSuperClassesAbstractMethodsFromInterface(interfaceClass);
for (Iterator i= temp.keySet().iterator(); i.hasNext(); )
{
String key = (String)i.next();
if (!exceptMethods.containsKey(key)) {
interfaceMethods.put(key, temp.get(key));
}
}
return interfaceMethods;
}
|
java
|
{
"resource": ""
}
|
q177136
|
ProfileObjectPoolManagement.createObjectPool
|
test
|
public void createObjectPool(final ProfileTableImpl profileTable,
final SleeTransactionManager sleeTransactionManager) {
if (logger.isTraceEnabled()) {
logger.trace("Creating Pool for " + profileTable);
}
createObjectPool(profileTable);
if (sleeTransactionManager != null) {
// add a rollback action to remove sbb object pool
TransactionalAction action = new TransactionalAction() {
public void execute() {
if (logger.isDebugEnabled()) {
logger
.debug("Due to tx rollback, removing pool for " + profileTable);
}
try {
removeObjectPool(profileTable);
} catch (Throwable e) {
logger.error("Failed to remove table's " + profileTable + " object pool", e);
}
}
};
sleeTransactionManager.getTransactionContext().getAfterRollbackActions().add(action);
}
}
|
java
|
{
"resource": ""
}
|
q177137
|
ProfileObjectPoolManagement.removeObjectPool
|
test
|
public void removeObjectPool(final ProfileTableImpl profileTable,
final SleeTransactionManager sleeTransactionManager) {
TransactionalAction action = new TransactionalAction() {
public void execute() {
if (logger.isTraceEnabled()) {
logger.trace("Removing Pool for " + profileTable);
}
removeObjectPool(profileTable);
}
};
if (sleeTransactionManager != null) {
sleeTransactionManager.getTransactionContext().getAfterCommitActions().add(action);
}
else {
action.execute();
}
}
|
java
|
{
"resource": ""
}
|
q177138
|
AlarmMBeanImpl.isSourceOwnerOfAlarm
|
test
|
public boolean isSourceOwnerOfAlarm(NotificationSourceWrapper notificationSource, String alarmID) {
AlarmPlaceHolder aph = this.alarmIdToAlarm.get(alarmID);
if (aph == null)
return false;
return aph.getNotificationSource().getNotificationSource().equals(notificationSource.getNotificationSource());
}
|
java
|
{
"resource": ""
}
|
q177139
|
AlarmMBeanImpl.raiseAlarm
|
test
|
public String raiseAlarm(NotificationSourceWrapper notificationSource, String alarmType, String instanceID, AlarmLevel level, String message, Throwable cause) {
synchronized (notificationSource) {
if (isAlarmAlive(notificationSource, alarmType, instanceID)) {
// Alarm a = this.placeHolderToAlarm.get(new
// AlarmPlaceHolder(notificationSource, alarmType, instanceID));
Alarm a = null;
// unconveniant....
try {
AlarmPlaceHolder localAPH = new AlarmPlaceHolder(notificationSource, alarmType, instanceID);
for (Map.Entry<String, AlarmPlaceHolder> e : this.alarmIdToAlarm.entrySet()) {
if (e.getValue().equals(localAPH)) {
a = e.getValue().getAlarm();
break;
}
}
} catch (Exception e) {
// ignore
}
if (a != null) {
return a.getAlarmID();
} else {
return this.raiseAlarm(notificationSource, alarmType, instanceID, level, message, cause);
}
} else {
Alarm a = new Alarm(UUID.randomUUID().toString(), notificationSource.getNotificationSource(), alarmType, instanceID, level, message, cause, System.currentTimeMillis());
AlarmPlaceHolder aph = new AlarmPlaceHolder(notificationSource, alarmType, instanceID, a);
this.alarmIdToAlarm.put(a.getAlarmID(), aph);
// this.placeHolderToAlarm.put(aph, a);
this.placeHolderToNotificationSource.put(aph, aph.getNotificationSource().getNotificationSource());
generateNotification(aph, false);
return a.getAlarmID();
}
}
}
|
java
|
{
"resource": ""
}
|
q177140
|
ProfileManagementHandler.getUsageParameterSet
|
test
|
public static Object getUsageParameterSet(ProfileObjectImpl profileObject,
String name) throws UnrecognizedUsageParameterSetNameException {
if (logger.isDebugEnabled()) {
logger.info("[getUsageParameterSet(" + name + ")] @ "
+ profileObject);
}
if (name == null) {
throw new NullPointerException(
"UsageParameterSet name must not be null.");
}
ProfileTableImpl profileTable = profileObject
.getProfileTable();
Object result = profileTable.getProfileTableUsageMBean()
.getInstalledUsageParameterSet(name);
if (result == null) {
throw new UnrecognizedUsageParameterSetNameException();
}
else {
return result;
}
}
|
java
|
{
"resource": ""
}
|
q177141
|
EventTypeComponentImpl.getSpecsDescriptor
|
test
|
public javax.slee.management.EventTypeDescriptor getSpecsDescriptor() {
if (specsDescriptor == null) {
specsDescriptor = new javax.slee.management.EventTypeDescriptor(getEventTypeID(),getDeployableUnit().getDeployableUnitID(),getDeploymentUnitSource(),descriptor.getLibraryRefs().toArray(new LibraryID[descriptor.getLibraryRefs().size()]),getDescriptor().getEventClassName());
}
return specsDescriptor;
}
|
java
|
{
"resource": ""
}
|
q177142
|
SLEESubDeployer.accepts
|
test
|
public boolean accepts(URL deployableUnitURL, String deployableUnitName) {
DeployableUnitWrapper du = new DeployableUnitWrapper(deployableUnitURL, deployableUnitName);
URL url = du.getUrl();
if (logger.isTraceEnabled()) {
logger.trace("Method accepts called for " + url + " [DU: " + deployableUnitName + "]");
}
try {
String fullPath = url.getFile();
String fileName = fullPath.substring(fullPath.lastIndexOf('/') + 1,
fullPath.length());
// Is it in the toAccept list ? Direct accept.
if (toAccept.containsKey(fileName)) {
if (logger.isTraceEnabled()) {
logger.trace("Accepting " + url.toString() + ".");
}
return true;
}
// If not it the accept list but it's a jar might be a DU jar...
else if (fileName.endsWith(".jar")) {
JarFile duJarFile = null;
try {
// Try to obtain the DU descriptor, if we got it, we're
// accepting it!
if (du.getEntry("META-INF/deployable-unit.xml") != null) {
if (logger.isTraceEnabled()) {
logger.trace("Accepting " + url.toString() + ".");
}
return true;
}
} finally {
// Clean up!
if (duJarFile != null) {
try {
duJarFile.close();
} catch (IOException ignore) {
} finally {
duJarFile = null;
}
}
}
}
} catch (Exception ignore) {
// Ignore.. will reject.
}
// Uh-oh.. looks like it will stay outside.
return false;
}
|
java
|
{
"resource": ""
}
|
q177143
|
SLEESubDeployer.init
|
test
|
public void init(URL deployableUnitURL, String deployableUnitName) throws DeploymentException {
URL url = deployableUnitURL;
DeployableUnitWrapper du = new DeployableUnitWrapper(deployableUnitURL, deployableUnitName);
if (logger.isTraceEnabled()) {
logger.trace("Method init called for " + deployableUnitURL + " [DU: " + deployableUnitName + "]");
}
// Get the full path and filename for this du
String fullPath = du.getFullPath();
String fileName = du.getFileName();
try {
DeployableUnitWrapper duWrapper = null;
// If we're able to remove it from toAccept was because it was
// there!
if ((duWrapper = toAccept.remove(fileName)) != null) {
// Create a new Deployable Component from this DI.
DeployableComponent dc = new DeployableComponent(du, url,
fileName, sleeContainerDeployer);
// Also get the deployable unit for this (it exists, we've
// checked!)
DeployableUnit deployerDU = deployableUnits.get(duWrapper
.getFileName());
for (DeployableComponent subDC : dc.getSubComponents()) {
// Add the sub-component to the DU object.
deployerDU.addComponent(subDC);
}
}
// If the DU for this component doesn't exists.. it's a new DU!
else if (fileName.endsWith(".jar")) {
JarFile duJarFile = null;
try {
// Get a reference to the DU jar file
duJarFile = new JarFile(fullPath);
// Try to get the Deployable Unit descriptor
JarEntry duXmlEntry = duJarFile
.getJarEntry("META-INF/deployable-unit.xml");
// Got descriptor?
if (duXmlEntry != null) {
// Create a new Deployable Unit object.
DeployableUnit deployerDU = new DeployableUnit(du,sleeContainerDeployer);
// Let's parse the descriptor to see what we've got...
DeployableUnitDescriptorFactory dudf = sleeContainerDeployer
.getSleeContainer().getComponentManagement()
.getDeployableUnitManagement()
.getDeployableUnitDescriptorFactory();
DeployableUnitDescriptor duDesc = dudf.parse(duJarFile
.getInputStream(duXmlEntry));
// If the filename is present, an undeploy in on the way... let's wait
while(deployableUnits.containsKey(fileName)) {
Thread.sleep(getWaitTimeBetweenOperations());
}
// Add it to the deployable units map.
deployableUnits.put(fileName, deployerDU);
// Go through each jar entry in the DU descriptor
for (String componentJarName : duDesc.getJarEntries()) {
// Might have path... strip it!
int beginIndex;
if ((beginIndex = componentJarName.lastIndexOf('/')) == -1)
beginIndex = componentJarName.lastIndexOf('\\');
beginIndex++;
// Got a clean jar name, no paths.
componentJarName = componentJarName.substring(
beginIndex, componentJarName.length());
// Put it in the accept list.
toAccept.put(componentJarName, du);
}
// Do the same as above... but for services
for (String serviceXMLName : duDesc.getServiceEntries()) {
// Might have path... strip it!
int beginIndex;
if ((beginIndex = serviceXMLName.lastIndexOf('/')) == -1)
beginIndex = serviceXMLName.lastIndexOf('\\');
beginIndex++;
// Got a clean XML filename
serviceXMLName = serviceXMLName.substring(
beginIndex, serviceXMLName.length());
// Add it to the accept list.
toAccept.put(serviceXMLName, du);
}
}
} finally {
// Clean up!
if (duJarFile != null) {
try {
duJarFile.close();
} catch (IOException ignore) {
} finally {
duJarFile = null;
}
}
}
}
} catch (Exception e) {
// Something went wrong...
logger.error("Deployment of " + fileName + " failed. ", e);
return;
}
}
|
java
|
{
"resource": ""
}
|
q177144
|
SLEESubDeployer.start
|
test
|
public void start(URL deployableUnitURL, String deployableUnitName) throws DeploymentException {
DeployableUnitWrapper du = new DeployableUnitWrapper(deployableUnitURL, deployableUnitName);
if (logger.isTraceEnabled()) {
logger.trace("Method start called for " + du.getUrl() + " [DU: " + deployableUnitName + "]");
}
try {
// Get the deployable unit object
DeployableUnit realDU = deployableUnits.get(du.getFileName());
// If it exists, install it.
if (realDU != null) {
while (isInUndeployList(du.getFileName())) {
Thread.sleep(getWaitTimeBetweenOperations());
}
sleeContainerDeployer.getDeploymentManager().installDeployableUnit(realDU);
}
} catch (Exception e) {
logger.error("", e);
}
}
|
java
|
{
"resource": ""
}
|
q177145
|
SLEESubDeployer.stop
|
test
|
public void stop(URL deployableUnitURL, String deployableUnitName) throws DeploymentException {
if (logger.isTraceEnabled()) {
logger.trace("stop( deployableUnitURL = : " + deployableUnitURL+" )");
}
DeployableUnitWrapper du = new DeployableUnitWrapper(deployableUnitURL, deployableUnitName);
DeployableUnit realDU = null;
String fileName = du.getFileName();
if ((realDU = deployableUnits.get(du.getFileName())) != null) {
if (logger.isTraceEnabled()) {
logger.trace("Got DU: " + realDU.getDeploymentInfoShortName());
}
if (!isInUndeployList(fileName)) {
addToUndeployList(fileName);
}
try {
// Uninstall it
sleeContainerDeployer.getDeploymentManager().uninstallDeployableUnit(realDU);
// Remove it from list if successful
deployableUnits.remove(fileName);
removeFromUndeployList(fileName);
} catch (DependencyException e) {
// ignore, will be tried again once there is another undeployment
} catch (Exception e) {
Throwable cause = e.getCause();
if (cause instanceof InvalidStateException) {
logger.warn(cause.getLocalizedMessage() + "... WAITING ...");
} else if (e instanceof DeploymentException) {
throw new IllegalStateException(e.getLocalizedMessage(), e);
} else {
logger.error(e.getMessage(), e);
}
}
}
}
|
java
|
{
"resource": ""
}
|
q177146
|
SLEESubDeployer.showStatus
|
test
|
public String showStatus() throws DeploymentException {
String output = "";
output += "<p>Deployable Units List:</p>";
for (String key : deployableUnits.keySet()) {
output += "<" + key + "> [" + deployableUnits.get(key)
+ "]<br>";
for (String duComponent : deployableUnits.get(key).getComponents()) {
output += "+-- " + duComponent + "<br>";
}
}
output += "<p>To Accept List:</p>";
for (String key : toAccept.keySet()) {
output += "<" + key + "> [" + toAccept.get(key) + "]<br>";
}
output += "<p>Undeployments running:</p>";
for (String undeploy : undeploys) {
output += "+-- " + undeploy + "<br>";
}
output += "<p>Deployment Manager Status</p>";
output += sleeContainerDeployer.getDeploymentManager().showStatus();
return output;
}
|
java
|
{
"resource": ""
}
|
q177147
|
TransactionContextImpl.executeAfterCommitActions
|
test
|
protected void executeAfterCommitActions() {
if (afterCommitActions != null) {
if (trace) {
logger.trace("Executing after commit actions");
}
executeActions(afterCommitActions,trace);
afterCommitActions = null;
}
}
|
java
|
{
"resource": ""
}
|
q177148
|
TransactionContextImpl.executeAfterCommitPriorityActions
|
test
|
protected void executeAfterCommitPriorityActions() {
if (afterCommitPriorityActions != null) {
if (trace) {
logger.trace("Executing after commit priority actions");
}
executeActions(afterCommitPriorityActions,trace);
afterCommitPriorityActions = null;
}
}
|
java
|
{
"resource": ""
}
|
q177149
|
TransactionContextImpl.executeAfterRollbackActions
|
test
|
protected void executeAfterRollbackActions() {
if (afterRollbackActions != null) {
if (trace) {
logger.trace("Executing rollback actions");
}
executeActions(afterRollbackActions,trace);
afterRollbackActions = null;
}
}
|
java
|
{
"resource": ""
}
|
q177150
|
TransactionContextImpl.executeBeforeCommitActions
|
test
|
protected void executeBeforeCommitActions() {
if (beforeCommitActions != null) {
if (trace) {
logger.trace("Executing before commit actions");
}
executeActions(beforeCommitActions,trace);
beforeCommitActions = null;
}
}
|
java
|
{
"resource": ""
}
|
q177151
|
TransactionContextImpl.executeBeforeCommitPriorityActions
|
test
|
protected void executeBeforeCommitPriorityActions() {
if (beforeCommitPriorityActions != null) {
if (trace) {
logger.trace("Executing before commit priority actions");
}
executeActions(beforeCommitPriorityActions,trace);
beforeCommitPriorityActions = null;
}
}
|
java
|
{
"resource": ""
}
|
q177152
|
TracerStorage.getDefinedTracerNames
|
test
|
public String[] getDefinedTracerNames() {
Set<String> names = new HashSet<String>();
for (TracerImpl t : this.tracers.values()) {
if (t.isExplicitlySetTracerLevel())
names.add(t.getTracerName());
}
if(names.isEmpty())
return new String[0];
return names.toArray(new String[names.size()]);
}
|
java
|
{
"resource": ""
}
|
q177153
|
TracerStorage.createTracer
|
test
|
public Tracer createTracer(String tracerName, boolean requestedBySource) {
TracerImpl tparent = null;
TracerImpl t = tracers.get(tracerName);
if (t == null) {
String[] split = tracerName.split("\\.");
String currentName = "";
for (String s : split) {
if (tparent == null) {
// first loop
tparent = rootTracer;
currentName = s;
} else {
currentName = currentName + "." + s;
}
t = tracers.get(currentName);
if (t == null) {
t = new TracerImpl(currentName, tparent, this.notificationSource, this.traceFacility);
final TracerImpl u = tracers.putIfAbsent(t.getTracerName(), t);
if (u != null) {
t = u;
}
}
tparent = t;
}
}
if (requestedBySource)
t.setRequestedBySource(requestedBySource);
return t;
}
|
java
|
{
"resource": ""
}
|
q177154
|
FaultTolerantResourceAdaptorContextImpl.removeReplicateData
|
test
|
public void removeReplicateData() {
if (replicatedDataWithFailover != null) {
replicatedDataWithFailover.remove();
replicatedDataWithFailover = null;
}
if (replicatedData != null) {
replicatedData.remove();
replicatedData = null;
}
}
|
java
|
{
"resource": ""
}
|
q177155
|
SleePropertyEditorRegistrator.register
|
test
|
public void register() {
PropertyEditorManager.registerEditor(ComponentID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(EventTypeID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(LibraryID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(ProfileSpecificationID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(ResourceAdaptorID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(ResourceAdaptorTypeID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(SbbID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(ServiceID.class,
ComponentIDPropertyEditor.class);
PropertyEditorManager.registerEditor(ComponentID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(EventTypeID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(LibraryID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(ProfileSpecificationID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(ResourceAdaptorID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(ResourceAdaptorTypeID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(SbbID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(ServiceID[].class,
ComponentIDArrayPropertyEditor.class);
PropertyEditorManager.registerEditor(DeployableUnitID.class,
DeployableUnitIDPropertyEditor.class);
PropertyEditorManager.registerEditor(Level.class,
LevelPropertyEditor.class);
PropertyEditorManager.registerEditor(TraceLevel.class,
TraceLevelPropertyEditor.class);
PropertyEditorManager.registerEditor(ConfigProperties.class,
ConfigPropertiesPropertyEditor.class);
PropertyEditorManager.registerEditor(NotificationSource.class,
NotificationSourcePropertyEditor.class);
PropertyEditorManager.registerEditor(Object.class,
ObjectPropertyEditor.class);
PropertyEditorManager.registerEditor(ServiceState.class,
ServiceStatePropertyEditor.class);
PropertyEditorManager.registerEditor(ResourceAdaptorEntityState.class,
ResourceAdaptorEntityStatePropertyEditor.class);
PropertyEditorManager.registerEditor(Address.class,
AddressPropertyEditor.class);
}
|
java
|
{
"resource": ""
}
|
q177156
|
SleeComponentWithUsageParametersClassCodeGenerator.process
|
test
|
public void process(SleeComponentWithUsageParametersInterface component) throws DeploymentException {
ClassPool classPool = component.getClassPool();
String deploymentDir = component.getDeploymentDir().getAbsolutePath();
Class<?> usageParametersInterface = component
.getUsageParametersInterface();
if (usageParametersInterface != null) {
try {
// generate the concrete usage param set class
component
.setUsageParametersConcreteClass(new ConcreteUsageParameterClassGenerator(
usageParametersInterface.getName(),
deploymentDir, classPool)
.generateConcreteUsageParameterClass());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Generated usage parameter impl class for "+component);
}
// generate the mbeans
new ConcreteUsageParameterMBeanGenerator(component)
.generateConcreteUsageParameterMBean();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Generated usage mbean (interface and impl) for "+component);
}
} catch (DeploymentException ex) {
throw ex;
} catch (Exception ex) {
throw new DeploymentException(
"Failed to generate "+component+" usage parameter class", ex);
}
}
}
|
java
|
{
"resource": ""
}
|
q177157
|
SbbObjectPoolManagementImpl.getObjectPool
|
test
|
public SbbObjectPoolImpl getObjectPool(ServiceID serviceID, SbbID sbbID) {
return pools.get(new ObjectPoolMapKey(serviceID,sbbID));
}
|
java
|
{
"resource": ""
}
|
q177158
|
SbbObjectPoolManagementImpl.createObjectPool
|
test
|
public void createObjectPool(final ServiceID serviceID, final SbbComponent sbbComponent,
final SleeTransactionManager sleeTransactionManager) {
if (logger.isTraceEnabled()) {
logger.trace("Creating Pool for " + serviceID +" and "+ sbbComponent);
}
createObjectPool(serviceID,sbbComponent);
if (sleeTransactionManager != null && sleeTransactionManager.getTransactionContext() != null) {
// add a rollback action to remove sbb object pool
TransactionalAction action = new TransactionalAction() {
public void execute() {
if (logger.isDebugEnabled()) {
logger
.debug("Due to tx rollback, removing pool for " + serviceID +" and "+ sbbComponent);
}
try {
removeObjectPool(serviceID,sbbComponent.getSbbID());
} catch (Throwable e) {
logger.error("Failed to remove " + serviceID +" and "+ sbbComponent + " object pool", e);
}
}
};
sleeTransactionManager.getTransactionContext().getAfterRollbackActions().add(action);
}
}
|
java
|
{
"resource": ""
}
|
q177159
|
SleeEndpointEndActivityNotTransactedExecutor.execute
|
test
|
void execute(final ActivityHandle handle)
throws UnrecognizedActivityHandleException {
final SleeTransaction tx = super.suspendTransaction();
try {
sleeEndpoint._endActivity(handle,tx);
} finally {
if (tx != null) {
super.resumeTransaction(tx);
}
}
}
|
java
|
{
"resource": ""
}
|
q177160
|
SleeEndpointImpl._startActivity
|
test
|
ActivityContextHandle _startActivity(ActivityHandle handle,
int activityFlags, final SleeTransaction barrierTx) {
ActivityContext ac = null;
if (raEntity.getHandleReferenceFactory() != null
&& !ActivityFlags.hasSleeMayMarshal(activityFlags)) {
final ActivityHandleReference reference = raEntity
.getHandleReferenceFactory().createActivityHandleReference(
handle);
try {
// create activity context with ref instead
ac = acFactory.createActivityContext(
new ResourceAdaptorActivityContextHandleImpl(raEntity,
reference), activityFlags);
} catch (ActivityAlreadyExistsException e) {
throw e;
} catch (RuntimeException e) {
raEntity.getHandleReferenceFactory()
.removeActivityHandleReference(reference);
throw e;
}
} else {
// create activity context
ac = acFactory.createActivityContext(
new ResourceAdaptorActivityContextHandleImpl(raEntity,
handle), activityFlags);
}
// suspend activity if needed
if (barrierTx != null && ac != null) {
final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager();
aeqm.createBarrier(barrierTx);
TransactionalAction action = new TransactionalAction() {
public void execute() {
aeqm.removeBarrier(barrierTx);
}
};
final TransactionContext tc = barrierTx.getTransactionContext();
tc.getAfterCommitActions().add(action);
tc.getAfterRollbackActions().add(action);
}
return ac.getActivityContextHandle();
}
|
java
|
{
"resource": ""
}
|
q177161
|
SleeEndpointImpl._endActivity
|
test
|
void _endActivity(ActivityHandle handle, final SleeTransaction barrierTx)
throws UnrecognizedActivityHandleException {
final ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl(
raEntity, handle);
// get ac
final ActivityContext ac = acFactory.getActivityContext(ach);
if (ac != null) {
// suspend activity if needed
if (barrierTx != null) {
final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager();
aeqm.createBarrier(barrierTx);
TransactionalAction action = new TransactionalAction() {
public void execute() {
aeqm.removeBarrier(barrierTx);
}
};
final TransactionContext tc = barrierTx.getTransactionContext();
tc.getAfterCommitActions().add(action);
tc.getAfterRollbackActions().add(action);
}
// end the activity
ac.endActivity();
} else {
throw new UnrecognizedActivityHandleException(handle.toString());
}
}
|
java
|
{
"resource": ""
}
|
q177162
|
SleeEndpointImpl.checkFireEventPreconditions
|
test
|
private void checkFireEventPreconditions(ActivityHandle handle,
FireableEventType eventType, Object event)
throws NullPointerException, IllegalEventException,
IllegalStateException {
if (event == null)
throw new NullPointerException("event is null");
if (handle == null)
throw new NullPointerException("handle is null");
if (eventType == null) {
throw new NullPointerException("eventType is null");
}
final EventTypeComponent eventTypeComponent = componentRepository
.getComponentByID(eventType.getEventType());
if (eventTypeComponent == null) {
throw new IllegalEventException(
"event type not installed (more on SLEE 1.1 specs 15.14.8)");
}
if (!eventTypeComponent.getEventTypeClass().isAssignableFrom(
event.getClass())) {
throw new IllegalEventException(
"the class of the event object fired is not assignable to the event class of the event type (more on SLEE 1.1 specs 15.14.8) ");
}
if (eventType.getClass() != FireableEventTypeImpl.class) {
throw new IllegalEventException(
"unknown implementation of FireableEventType");
}
if (raEntity.getAllowedEventTypes() != null
&& !raEntity.getAllowedEventTypes().contains(
eventType.getEventType())) {
throw new IllegalEventException(
"Resource Adaptor configured to not ignore ra type event checking and the event "
+ eventType.getEventType()
+ " does not belongs to any of the ra types implemented by the resource adaptor");
}
}
|
java
|
{
"resource": ""
}
|
q177163
|
SleeEndpointImpl._fireEvent
|
test
|
void _fireEvent(ActivityHandle realHandle, ActivityHandle refHandle,
FireableEventType eventType, Object event, Address address,
ReceivableService receivableService, int eventFlags, final SleeTransaction barrierTx)
throws ActivityIsEndingException, SLEEException {
final ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl(
raEntity, refHandle);
// get ac
final ActivityContext ac = acFactory.getActivityContext(ach);
if (ac == null) {
throw new UnrecognizedActivityHandleException("Unable to fire "
+ eventType.getEventType() + " on activity handle "
+ realHandle
+ " , the handle is not mapped to an activity context");
} else {
// suspend activity if needed
if (barrierTx != null) {
final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager();
aeqm.createBarrier(barrierTx);
TransactionalAction action = new TransactionalAction() {
public void execute() {
aeqm.removeBarrier(barrierTx);
}
};
final TransactionContext tc = barrierTx.getTransactionContext();
tc.getAfterCommitActions().add(action);
tc.getAfterRollbackActions().add(action);
}
final EventProcessingCallbacks callbacks = new EventProcessingCallbacks(
realHandle, eventType, event, address, receivableService,
eventFlags, raEntity);
final EventProcessingSucceedCallback succeedCallback = EventFlags
.hasRequestProcessingSuccessfulCallback(eventFlags) ? callbacks
: null;
final EventProcessingFailedCallback failedCallback = EventFlags
.hasRequestProcessingFailedCallback(eventFlags) ? callbacks
: null;
final EventUnreferencedCallback unreferencedCallback = EventFlags
.hasRequestEventReferenceReleasedCallback(eventFlags) ? callbacks
: null;
ac.fireEvent(eventType.getEventType(), event, address,
receivableService == null ? null : receivableService
.getService(), succeedCallback, failedCallback,
unreferencedCallback);
}
}
|
java
|
{
"resource": ""
}
|
q177164
|
ConcreteSbbLocalObjectGenerator.generateSbbLocalObjectConcreteClass
|
test
|
public Class generateSbbLocalObjectConcreteClass() {
//Generates the implements link
if (logger.isTraceEnabled()) {
logger.trace("generateSbbLocalObjectConcreteClass: sbbLocalObjectInterface = "
+ sbbLocalObjectName
+ " deployPath = "
+ deployPath);
}
try {
concreteSbbLocalObject = pool.makeClass(ConcreteClassGeneratorUtils.SBB_LOCAL_OBJECT_CLASS_NAME_PREFIX + sbbLocalObjectName + ConcreteClassGeneratorUtils.SBB_LOCAL_OBJECT_CLASS_NAME_SUFFIX);
try {
sleeSbbLocalObject = pool.get(SbbLocalObjectImpl.class
.getName());
sbbLocalObjectInterface = pool.get(sbbLocalObjectName);
} catch (NotFoundException nfe) {
nfe.printStackTrace();
String s = "Problem with pool ";
logger.error(s, nfe);
throw new RuntimeException(s, nfe);
}
// This is our implementation interface.
CtClass concreteClassInterface;
try {
concreteClassInterface = pool.get(SbbLocalObjectConcrete.class
.getName());
} catch (NotFoundException nfe) {
nfe.printStackTrace();
String s = "Problem with the pool! ";
logger.error(s, nfe);
throw new RuntimeException(s, nfe);
}
ConcreteClassGeneratorUtils.createInterfaceLinks(
concreteSbbLocalObject, new CtClass[] {
sbbLocalObjectInterface, concreteClassInterface });
//Generates an inheritance link to the slee implementation of the
// SbbLocalObject interface
ConcreteClassGeneratorUtils.createInheritanceLink(
concreteSbbLocalObject, sleeSbbLocalObject);
//Generates the methods to implement from the interface
Map interfaceMethods = ClassUtils
.getInterfaceMethodsFromInterface(sbbLocalObjectInterface);
generateConcreteMethods(interfaceMethods, sbbAbstractClassName);
try {
concreteSbbLocalObject.writeFile(deployPath);
if (logger.isDebugEnabled()) {
logger
.debug("Concrete Class "
+ concreteSbbLocalObject.getName()
+ " generated in the following path "
+ deployPath);
}
} catch (CannotCompileException e) {
String s = " Unexpected exception ! ";
logger.fatal(s, e);
throw new RuntimeException(s, e);
} catch (IOException e) {
String s = "IO Exception!";
logger.error(s, e);
return null;
}
//load the class
try {
return Thread.currentThread().getContextClassLoader().loadClass(concreteSbbLocalObject.getName());
} catch (ClassNotFoundException e) {
logger.error("unable to load sbb local object impl class", e);
return null;
}
} finally {
if (this.concreteSbbLocalObject != null)
this.concreteSbbLocalObject.defrost();
}
}
|
java
|
{
"resource": ""
}
|
q177165
|
AccessorOperation.makeGetter
|
test
|
protected void makeGetter() {
if(fieldClass.equals(boolean.class) || fieldClass.equals(Boolean.class)) {
super.operationName = "is" + this.beanFieldName;
} else {
super.operationName = "get" + this.beanFieldName;
}
}
|
java
|
{
"resource": ""
}
|
q177166
|
AccessorOperation.convert
|
test
|
protected Object convert(String optArg) throws SecurityException, NoSuchMethodException, IllegalArgumentException,
InstantiationException, IllegalAccessException, InvocationTargetException, CommandException {
if (fieldClass.isPrimitive()) {
// TODO: to optimize, to rework new to valueOf
if (fieldClass.equals(int.class)) {
return new Integer(optArg);
} else if (fieldClass.equals(long.class)) {
return new Long(optArg);
} else if (fieldClass.equals(int.class)) {
return new Integer(optArg);
} else if (fieldClass.equals(byte.class)) {
return new Byte(optArg);
} else if (fieldClass.equals(short.class)) {
return new Short(optArg);
} else if (fieldClass.equals(float.class)) {
return new Float(optArg);
} else if (fieldClass.equals(double.class)) {
return new Double(optArg);
} else if (fieldClass.equals(boolean.class)) {
return new Boolean(optArg);
} else if(fieldClass.equals(char.class)) {
return new Character(optArg.charAt(0));
} //?
throw new CommandException("Unpredicted place. Please report.");
} else if (isClassNumber()) {
//Handle Long, Integer, .., Boolean
Constructor<?> con = fieldClass.getConstructor(String.class);
return con.newInstance(optArg);
}
return optArg;
}
|
java
|
{
"resource": ""
}
|
q177167
|
ProfileID.setProfileID
|
test
|
public final void setProfileID(String profileTableName, String profileName) throws NullPointerException, IllegalArgumentException {
if (profileTableName == null) throw new NullPointerException("profileTableName is null");
if (profileName == null) throw new NullPointerException("profileName is null");
if (profileTableName.indexOf('/') >= 0) throw new IllegalArgumentException("profileTableName cannot contain the '/' character");
this.profileTableName = profileTableName;
this.profileName = profileName;
this.address = null;
}
|
java
|
{
"resource": ""
}
|
q177168
|
DeployableUnitInstallPanel.extractMessage
|
test
|
private String extractMessage(String result) {
// Fix:
// Firefox 2 encapsulates the text inside <pre> tag
String startPreTag = "<pre>";
String endPreTag = "</pre>";
result = result.trim();
if (result.startsWith(startPreTag) && result.endsWith(endPreTag)) {
result = result.substring(startPreTag.length(), result.length() - endPreTag.length());
}
return result;
}
|
java
|
{
"resource": ""
}
|
q177169
|
ChildRelationImpl.contains
|
test
|
public boolean contains(Object object) {
if (!(object instanceof SbbLocalObject))
return false;
final SbbLocalObjectImpl sbblocal = (SbbLocalObjectImpl) object;
final SbbEntityID sbbEntityId = sbblocal.getSbbEntityId();
if(!idBelongsToChildRelation(sbbEntityId)) {
return false;
}
return new SbbEntityCacheData(sbbEntityId,sleeContainer.getCluster().getMobicentsCache()).exists();
}
|
java
|
{
"resource": ""
}
|
q177170
|
ChildRelationImpl.containsAll
|
test
|
@SuppressWarnings("rawtypes")
public boolean containsAll(Collection c) {
if (c == null)
throw new NullPointerException("null collection!");
for (Iterator it = c.iterator(); it.hasNext(); ) {
if (!contains(it.next())) {
return false;
}
}
if(logger.isDebugEnabled()) {
logger.debug("containsAll : collection = " + c + " > all in child relation");
}
return true;
}
|
java
|
{
"resource": ""
}
|
q177171
|
ChildRelationImpl.removeAll
|
test
|
@SuppressWarnings("rawtypes")
public boolean removeAll(Collection c) {
boolean flag = true;
if (c == null)
throw new NullPointerException(" null collection ! ");
for ( Iterator it = c.iterator(); it.hasNext(); ) {
flag &= this.remove( it.next());
}
return flag;
}
|
java
|
{
"resource": ""
}
|
q177172
|
Level.isHigherLevel
|
test
|
public boolean isHigherLevel(Level other) throws NullPointerException {
if (other == null) throw new NullPointerException("other is null");
return this.level < other.level;
}
|
java
|
{
"resource": ""
}
|
q177173
|
Level.readResolve
|
test
|
private Object readResolve() throws StreamCorruptedException {
if (level == LEVEL_OFF) return OFF;
if (level == LEVEL_SEVERE) return SEVERE;
if (level == LEVEL_WARNING) return WARNING;
if (level == LEVEL_INFO) return INFO;
if (level == LEVEL_CONFIG) return CONFIG;
if (level == LEVEL_FINE) return FINE;
if (level == LEVEL_FINER) return FINER;
if (level == LEVEL_FINEST) return FINEST;
throw new StreamCorruptedException("Invalid internal state found");
}
|
java
|
{
"resource": ""
}
|
q177174
|
ClassPool.clean
|
test
|
public void clean() {
for (ClassPath classPath : classPaths) {
classPool.removeClassPath(classPath);
}
for (String classMade : classesMade) {
try {
classPool.get(classMade).detach();
} catch (NotFoundException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to detach class " + classMade
+ " from class pool", e);
}
}
}
}
|
java
|
{
"resource": ""
}
|
q177175
|
ProfileCallRecorderTransactionData.addProfileCall
|
test
|
@SuppressWarnings("unchecked")
public static void addProfileCall(ProfileObjectImpl po) throws SLEEException
{
SleeTransactionManager sleeTransactionManager = sleeContainer.getTransactionManager();
try {
if(sleeTransactionManager.getTransaction() == null) {
return;
}
}
catch ( SystemException se ) {
throw new SLEEException("Unable to verify SLEE Transaction.", se);
}
String key = makeKey(po);
if (logger.isTraceEnabled()) {
logger.trace("Recording call to profile. Key[" + key + "]");
}
final TransactionContext txContext = sleeTransactionManager.getTransactionContext();
ProfileCallRecorderTransactionData data = (ProfileCallRecorderTransactionData) txContext.getData().get(TRANSACTION_CONTEXT_KEY);
// If data does not exist, create it
if (data == null) {
data = new ProfileCallRecorderTransactionData();
txContext.getData().put(TRANSACTION_CONTEXT_KEY, data);
}
if (!po.isProfileReentrant())
{
// we need to check
if (data.invokedProfiles.contains(key) && data.invokedProfiles.getLast().compareTo(key) != 0) {
throw new SLEEException("Detected loopback call. Call sequence: " + data.invokedProfiles);
}
data.invokedProfiles.add(key);
data.invokedProfileTablesNames.add(po.getProfileTable().getProfileTableName());
}
}
|
java
|
{
"resource": ""
}
|
q177176
|
ProfileTableTransactionView.getProfile
|
test
|
public ProfileObjectImpl getProfile(String profileName)
throws TransactionRequiredLocalException, SLEEException {
Map txData = getTxData();
ProfileTransactionID key = new ProfileTransactionID(profileName,
profileTable.getProfileTableName());
ProfileObjectImpl value = (ProfileObjectImpl) txData.get(key);
if (value == null) {
ProfileObjectPool pool = profileTable.getProfileManagement()
.getObjectPoolManagement().getObjectPool(
profileTable.getProfileTableName());
value = pool.borrowObject();
passivateProfileObjectOnTxEnd(profileTable.getSleeContainer()
.getTransactionManager(), value, pool);
try {
value.profileActivate(profileName);
} catch (UnrecognizedProfileNameException e) {
value.invalidateObject();
pool.invalidateObject(value);
return null;
}
txData.put(key, value);
}
return value;
}
|
java
|
{
"resource": ""
}
|
q177177
|
ProfileTableTransactionView.passivateProfileObjectOnTxEnd
|
test
|
public static void passivateProfileObjectOnTxEnd(
SleeTransactionManager txManager,
final ProfileObjectImpl profileObject, final ProfileObjectPool pool) {
TransactionalAction afterRollbackAction = new TransactionalAction() {
public void execute() {
profileObject.invalidateObject();
pool.returnObject(profileObject);
}
};
TransactionalAction beforeCommitAction = new TransactionalAction() {
public void execute() {
if (profileObject.getState() == ProfileObjectState.READY) {
if (!profileObject.getProfileEntity().isRemove()) {
profileObject.fireAddOrUpdatedEventIfNeeded();
profileObject.profilePassivate();
} else {
profileObject.profileRemove(true, false);
}
pool.returnObject(profileObject);
}
}
};
final TransactionContext txContext = txManager.getTransactionContext();
txContext.getAfterRollbackActions().add(afterRollbackAction);
txContext.getBeforeCommitActions().add(beforeCommitAction);
}
|
java
|
{
"resource": ""
}
|
q177178
|
ComponentIDArrayPropertyEditor.setAsText
|
test
|
public void setAsText(String text ) {
if ( text == null || text.equals("")) {
super.setValue( new ComponentID[0]);
} else {
java.util.ArrayList results = new java.util.ArrayList();
// the format for component ID is name vendor version.
java.util.StringTokenizer st = new java.util.StringTokenizer(text,CID_SEPARATOR,true);
ComponentIDPropertyEditor cidPropEditor = new ComponentIDPropertyEditor();
while (st.hasMoreTokens()) {
cidPropEditor.setAsText(st.nextToken());
if (st.hasMoreTokens()) {
st.nextToken();
}
results.add(cidPropEditor.getValue());
}
ComponentID[] cid = new ComponentID[results.size()];
results.toArray(cid);
this.setValue(cid);
}
}
|
java
|
{
"resource": ""
}
|
q177179
|
ConcreteActivityContextInterfaceGenerator.generateActivityContextInterfaceConcreteClass
|
test
|
public Class generateActivityContextInterfaceConcreteClass()
throws DeploymentException {
String tmpClassName = ConcreteClassGeneratorUtils.CONCRETE_ACTIVITY_INTERFACE_CLASS_NAME_PREFIX
+ activityContextInterfaceName
+ ConcreteClassGeneratorUtils.CONCRETE_ACTIVITY_INTERFACE_CLASS_NAME_SUFFIX;
concreteActivityContextInterface = pool.makeClass(tmpClassName);
CtClass sbbActivityContextInterface = null;
try {
activityContextInterface = pool.get(activityContextInterfaceName);
sbbActivityContextInterface = pool
.get(SbbActivityContextInterfaceImpl.class.getName());
} catch (NotFoundException nfe) {
throw new DeploymentException("Could not find aci "
+ activityContextInterfaceName, nfe);
}
// Generates the extends link
ConcreteClassGeneratorUtils.createInheritanceLink(
concreteActivityContextInterface, sbbActivityContextInterface);
// Generates the implements link
ConcreteClassGeneratorUtils.createInterfaceLinks(
concreteActivityContextInterface,
new CtClass[] { activityContextInterface });
// Generates the methods to implement from the interface
Map interfaceMethods = ClassUtils
.getInterfaceMethodsFromInterface(activityContextInterface);
generateConcreteMethods(interfaceMethods);
// generates the class
String sbbDeploymentPathStr = deployDir;
try {
concreteActivityContextInterface.writeFile(sbbDeploymentPathStr);
if (logger.isDebugEnabled()) {
logger.debug("Concrete Class " + tmpClassName
+ " generated in the following path "
+ sbbDeploymentPathStr);
}
} catch (Exception e) {
logger.error("problem generating concrete class", e);
throw new DeploymentException(
"problem generating concrete class! ", e);
}
// load the class
Class clazz = null;
try {
clazz = Thread.currentThread().getContextClassLoader().loadClass(
tmpClassName);
} catch (Exception e1) {
logger.error("problem loading generated class", e1);
throw new DeploymentException(
"problem loading the generated class! ", e1);
}
this.concreteActivityContextInterface.defrost();
return clazz;
}
|
java
|
{
"resource": ""
}
|
q177180
|
ConcreteActivityContextInterfaceGenerator.generateConcreteMethods
|
test
|
private void generateConcreteMethods(Map interfaceMethods) {
if (interfaceMethods == null)
return;
Iterator it = interfaceMethods.values().iterator();
while (it.hasNext()) {
CtMethod interfaceMethod = (CtMethod) it.next();
if (interfaceMethod != null
//&& isBaseInterfaceMethod(interfaceMethod.getName()))
&& (interfaceMethod.getDeclaringClass().getName().equals(
javax.slee.ActivityContextInterface.class.getName()) || interfaceMethod.getDeclaringClass().getName().equals(
ActivityContextInterfaceExt.class.getName())))
continue; // @todo: need to check args also
try {
// copy method from abstract to concrete class
CtMethod concreteMethod = CtNewMethod.copy(interfaceMethod,
concreteActivityContextInterface, null);
// create the method body
String fieldName = interfaceMethod.getName().substring(3);
fieldName = fieldName.substring(0, 1).toLowerCase()
+ fieldName.substring(1);
String concreteMethodBody = null;
if (interfaceMethod.getName().startsWith("get")) {
concreteMethodBody = "{ return ($r)getFieldValue(\""
+ fieldName + "\","+concreteMethod.getReturnType().getName()+".class); }";
} else if (interfaceMethod.getName().startsWith("set")) {
concreteMethodBody = "{ setFieldValue(\"" + fieldName
+ "\",$1); }";
} else {
throw new SLEEException("unexpected method name <"
+ interfaceMethod.getName()
+ "> to implement in sbb aci interface");
}
if (logger.isTraceEnabled()) {
logger.trace("Generated method "
+ interfaceMethod.getName() + " , body = "
+ concreteMethodBody);
}
concreteMethod.setBody(concreteMethodBody);
concreteActivityContextInterface.addMethod(concreteMethod);
} catch (Exception cce) {
throw new SLEEException("Cannot compile method "
+ interfaceMethod.getName(), cce);
}
}
}
|
java
|
{
"resource": ""
}
|
q177181
|
ActivityContextImpl.setDataAttribute
|
test
|
public void setDataAttribute(String key, Object newValue) {
cacheData.setCmpAttribute(key, newValue);
if (logger.isDebugEnabled()) {
logger.debug("Activity context with handle "
+ getActivityContextHandle() + " set cmp attribute named "
+ key + " to value " + newValue);
}
}
|
java
|
{
"resource": ""
}
|
q177182
|
ActivityContextImpl.addNameBinding
|
test
|
public void addNameBinding(String aciName) {
cacheData.nameBound(aciName);
if (acReferencesHandler != null) {
acReferencesHandler.nameReferenceCreated();
}
}
|
java
|
{
"resource": ""
}
|
q177183
|
ActivityContextImpl.removeNamingBindings
|
test
|
private void removeNamingBindings() {
ActivityContextNamingFacility acf = sleeContainer
.getActivityContextNamingFacility();
for (Object obj : cacheData.getNamesBoundCopy()) {
String aciName = (String) obj;
try {
acf.removeName(aciName);
} catch (Exception e) {
logger.warn("failed to unbind name: " + aciName + " from ac:"
+ getActivityContextHandle(), e);
}
}
}
|
java
|
{
"resource": ""
}
|
q177184
|
ActivityContextImpl.removeNameBinding
|
test
|
public boolean removeNameBinding(String aciName) {
boolean removed = cacheData.nameUnbound(aciName);
if (removed && acReferencesHandler != null) {
acReferencesHandler.nameReferenceRemoved();
}
return removed;
}
|
java
|
{
"resource": ""
}
|
q177185
|
ActivityContextImpl.attachTimer
|
test
|
public boolean attachTimer(TimerID timerID) {
if (cacheData.attachTimer(timerID)) {
if (acReferencesHandler != null) {
acReferencesHandler.timerReferenceCreated();
}
return true;
} else {
return false;
}
}
|
java
|
{
"resource": ""
}
|
q177186
|
ActivityContextImpl.removeFromTimers
|
test
|
private void removeFromTimers() {
TimerFacility timerFacility = sleeContainer.getTimerFacility();
// Iterate through the attached timers, telling the timer facility to
// remove them
for (Object obj : cacheData.getAttachedTimers()) {
timerFacility.cancelTimer((TimerID) obj, false);
}
}
|
java
|
{
"resource": ""
}
|
q177187
|
ActivityContextImpl.attachSbbEntity
|
test
|
public boolean attachSbbEntity(SbbEntityID sbbEntityId) {
boolean attached = cacheData.attachSbbEntity(sbbEntityId);
if (attached) {
if (acReferencesHandler != null) {
acReferencesHandler.sbbeReferenceCreated(false);
}
}
if (logger.isTraceEnabled()) {
logger.trace("Attachement from sbb entity " + sbbEntityId
+ " to AC " + getActivityContextHandle() + " result: "
+ attached);
}
return attached;
}
|
java
|
{
"resource": ""
}
|
q177188
|
ActivityContextImpl.detachSbbEntity
|
test
|
public void detachSbbEntity(SbbEntityID sbbEntityId)
throws javax.slee.TransactionRequiredLocalException {
boolean detached = cacheData.detachSbbEntity(sbbEntityId);
if (detached && acReferencesHandler != null && !isEnding()) {
acReferencesHandler.sbbeReferenceRemoved();
if (logger.isTraceEnabled()) {
logger.trace("Detached sbb entity " + sbbEntityId
+ " from AC with handle " + getActivityContextHandle());
}
}
}
|
java
|
{
"resource": ""
}
|
q177189
|
ActivityContextImpl.getSortedSbbAttachmentSet
|
test
|
public Set<SbbEntityID> getSortedSbbAttachmentSet(
Set<SbbEntityID> excludeSet) {
final Set<SbbEntityID> sbbAttachementSet = cacheData
.getSbbEntitiesAttached();
Set<SbbEntityID> result = new HashSet<SbbEntityID>();
for (SbbEntityID sbbEntityId : sbbAttachementSet) {
if (!excludeSet.contains(sbbEntityId)) {
result.add(sbbEntityId);
}
}
if (result.size() > 1) {
result = sleeContainer.getSbbEntityFactory().sortByPriority(result);
}
return result;
}
|
java
|
{
"resource": ""
}
|
q177190
|
ActivityContextImpl.endActivity
|
test
|
public void endActivity() {
if (logger.isDebugEnabled()) {
logger.debug("Ending activity context with handle "
+ getActivityContextHandle());
}
if (cacheData.setEnding(true)) {
fireEvent(
sleeContainer
.getEventContextFactory()
.createActivityEndEventContext(
this,
new ActivityEndEventUnreferencedCallback(
getActivityContextHandle(), factory)),
sleeContainer.getTransactionManager()
.getTransactionContext());
}
}
|
java
|
{
"resource": ""
}
|
q177191
|
DeployableUnit.addComponent
|
test
|
public void addComponent(DeployableComponent dc) {
if (logger.isTraceEnabled())
logger.trace("Adding Component " + dc.getComponentKey());
// Add the component ..
components.add(dc);
// .. the key ..
componentIDs.add(dc.getComponentKey());
// .. the dependencies ..
dependencies.addAll(dc.getDependencies());
// .. the install actions to be taken ..
installActions.addAll(dc.getInstallActions());
// .. post-install actions (if any) ..
Collection<ManagementAction> postInstallActionsStrings = postInstallActions
.remove(dc.getComponentKey());
if (postInstallActionsStrings != null
&& !postInstallActionsStrings.isEmpty()) {
installActions.addAll(postInstallActionsStrings);
}
// .. pre-uninstall actions (if any) ..
Collection<ManagementAction> preUninstallActionsStrings = preUninstallActions
.remove(dc.getComponentKey());
if (preUninstallActionsStrings != null)
uninstallActions.addAll(preUninstallActionsStrings);
// .. and finally the uninstall actions to the DU.
uninstallActions.addAll(dc.getUninstallActions());
}
|
java
|
{
"resource": ""
}
|
q177192
|
DeployableUnit.getExternalDependencies
|
test
|
public Collection<String> getExternalDependencies() {
// Take all dependencies...
Collection<String> externalDependencies = new HashSet<String>(dependencies);
// Remove those which are contained in this DU
externalDependencies.removeAll(componentIDs);
// Return what's left.
return externalDependencies;
}
|
java
|
{
"resource": ""
}
|
q177193
|
DeployableUnit.hasDependenciesSatisfied
|
test
|
public boolean hasDependenciesSatisfied(boolean showMissing) {
// First of all check if it is self-sufficient
if (isSelfSufficient())
return true;
// If not self-sufficient, get the remaining dependencies
Collection<String> externalDependencies = getExternalDependencies();
// Remove those that are already installed...
externalDependencies.removeAll(sleeContainerDeployer.getDeploymentManager().getDeployedComponents());
// Some remaining?
if (!externalDependencies.isEmpty()) {
if (showMissing) {
// List them to the user...
String missingDepList = "";
for (String missingDep : externalDependencies)
missingDepList += "\r\n +-- " + missingDep;
logger.info("Missing dependencies for " + this.diShortName
+ ":" + missingDepList);
}
// Return dependencies not satified.
return false;
}
// OK, dependencies satisfied!
return true;
}
|
java
|
{
"resource": ""
}
|
q177194
|
DeployableUnit.hasDuplicates
|
test
|
public boolean hasDuplicates() {
ArrayList<String> duplicates = new ArrayList<String>();
// For each component in the DU ..
for (String componentId : componentIDs) {
// Check if it is already deployed
if (sleeContainerDeployer.getDeploymentManager().getDeployedComponents().contains(componentId)) {
duplicates.add(componentId);
}
}
if (!duplicates.isEmpty()) {
logger.warn("The deployable unit '" + this.diShortName + "' contains components that are already deployed. The following are already installed:");
for (String dupComponent : duplicates) {
logger.warn(" - " + dupComponent);
}
return true;
}
// If we got here, there's no dups.
return false;
}
|
java
|
{
"resource": ""
}
|
q177195
|
DeployableUnit.getInstallActions
|
test
|
public Collection<ManagementAction> getInstallActions() {
ArrayList<ManagementAction> iActions = new ArrayList<ManagementAction>();
// if we have some remaining post install actions it means it is actions related with components already installed
// thus should be executed first
if (!postInstallActions.values().isEmpty()) {
for (String componentId : postInstallActions.keySet()) {
iActions.addAll(postInstallActions.get(componentId));
}
}
iActions.addAll(installActions);
return iActions;
}
|
java
|
{
"resource": ""
}
|
q177196
|
DeployableUnit.getUninstallActions
|
test
|
public Collection<ManagementAction> getUninstallActions() {
Collection<ManagementAction> uActions = new ArrayList<ManagementAction>(uninstallActions);
// ensures uninstall is the last action related with DU components
uActions.add(new UninstallDeployableUnitAction(diURL.toString(), sleeContainerDeployer.getDeploymentMBean()));
// if we have some remaining uninstall actions it means it is actions related with components not in DU
// thus should be executed last
if (!preUninstallActions.values().isEmpty()) {
for (String componentId : preUninstallActions.keySet()) {
uActions.addAll(preUninstallActions.get(componentId));
}
}
return uActions;
}
|
java
|
{
"resource": ""
}
|
q177197
|
DeployableUnit.hasReferringDU
|
test
|
private boolean hasReferringDU() throws Exception {
// Get SleeContainer instance from JNDI
SleeContainer sC = SleeContainer.lookupFromJndi();
for (String componentIdString : this.getComponents()) {
ComponentIDPropertyEditor cidpe = new ComponentIDPropertyEditor();
cidpe.setAsText( componentIdString );
ComponentID componentId = (ComponentID) cidpe.getValue();
for (ComponentID referringComponentId : sC.getComponentRepository().getReferringComponents(componentId)) {
ComponentIDPropertyEditor rcidpe = new ComponentIDPropertyEditor();
rcidpe.setValue( referringComponentId );
String referringComponentIdString = rcidpe.getAsText();
if (!this.getComponents().contains( referringComponentIdString )) {
return true;
}
}
}
return false;
}
|
java
|
{
"resource": ""
}
|
q177198
|
AbstractProfileMBeanImpl.close
|
test
|
public static void close(String profileTableName, String profileName) {
final ObjectName objectName = getObjectName(profileTableName, profileName);
if (sleeContainer.getMBeanServer().isRegistered(objectName)) {
Runnable r = new Runnable() {
public void run() {
try {
sleeContainer.getMBeanServer().invoke(objectName, "close", new Object[]{}, new String[]{});
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
};
Thread t = new Thread(r);
t.start();
}
}
|
java
|
{
"resource": ""
}
|
q177199
|
AbstractProfileMBeanImpl.getObjectName
|
test
|
public static ObjectName getObjectName(
String profileTableName, String profileName) {
// FIXME use only the "quoted" version when issue is fully solved at the JMX Console side
try {
return new ObjectName(ProfileMBean.BASE_OBJECT_NAME + ','
+ ProfileMBean.PROFILE_TABLE_NAME_KEY + '='
+ profileTableName + ','
+ ProfileMBean.PROFILE_NAME_KEY + '='
+ (profileName != null ? profileName : ""));
} catch (Throwable e) {
try {
return new ObjectName(ProfileMBean.BASE_OBJECT_NAME + ','
+ ProfileMBean.PROFILE_TABLE_NAME_KEY + '='
+ ObjectName.quote(profileTableName) + ','
+ ProfileMBean.PROFILE_NAME_KEY + '='
+ ObjectName.quote(profileName != null ? profileName : ""));
} catch (Throwable f) {
throw new SLEEException(e.getMessage(), e);
}
}
}
|
java
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.