/** * Using Singleton pattern * * @return */ public static synchronized SleeProfileManager getInstance() { if (sleeProfileManager == null) throw new SLEEException("Access attempted before initialization of " + SleeProfileManager.class.getName()); return sleeProfileManager; }
log.error(e.getMessage(), e); } catch (SLEEException e) { log.error(e.getMessage(), e); } catch (SipException e) { log.error(e.getMessage(), e);
log.severe(e.getMessage(), e); } catch (SLEEException e) { log.severe(e.getMessage(), e); } catch (ParseException e) { log.severe(e.getMessage(), e);
private void doGeneralChecks() { if (this.profileTable == null) throw new SLEEException("Profile table has not been set."); if (this.profileTable.getProfileTableNotification() == null) throw new SLEEException("Profile table has no notification source."); }
log.severe(e.getMessage(), e); } catch (SLEEException e) { log.severe(e.getMessage(), e); } catch (SipException e) { log.severe(e.getMessage(), e);
public ObjectName getSleeManagementMBean() { try { return new ObjectName(SleeManagementMBean.OBJECT_NAME); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } }
public ProfileObjectImpl borrowObject() throws SLEEException { ProfileObjectImpl obj = null; try { obj = (ProfileObjectImpl) pool.borrowObject(); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } if (logger.isTraceEnabled()) { logger.trace("borrowed object "+obj + " from " + this); } return obj; }
public void invalidateObject(ProfileObject obj) { try { pool.invalidateObject(obj); } catch (Exception e) { throw new SLEEException(e.getMessage(),e); } if (logger.isTraceEnabled()) { logger.trace("invalidated object "+obj + " to " + this); } } }
/** * */ public void unregisterUsageMBean() { if (this.profileTableUsageMBean != null) { try { this.profileTableUsageMBean.remove(); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } } }
/** * * @param lock * @param sbbeId * @throws SLEEException */ private static void lockOrFail(ReentrantLock lock, SbbEntityID sbbeId) throws SLEEException { if (doTraceLogs) { logger.trace(Thread.currentThread()+" trying to acquire lock "+lock+" for sbb entity with id "+sbbeId); } boolean locked; try { locked = lock.tryLock(10, TimeUnit.SECONDS); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } if (!locked) { throw new SLEEException("timeout while acquiring lock "+lock+" for sbb entity with id "+sbbeId); } if (doTraceLogs) { logger.trace(Thread.currentThread()+" acquired lock "+lock+" for sbb entity with id "+sbbeId); } }
/** * * @param lock * @param sbbeId * @throws SLEEException */ private static void lockOrFail(ReentrantLock lock, String sbbeId) throws SLEEException { if (logger.isDebugEnabled()) { logger.debug(Thread.currentThread()+" trying to acquire lock "+lock+" for sbb entity with id "+sbbeId); } boolean locked; try { locked = lock.tryLock(10, TimeUnit.SECONDS); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } if (!locked) { throw new SLEEException("timeout while acquiring lock "+lock+" for sbb entity with id "+sbbeId); } if (logger.isDebugEnabled()) { logger.debug(Thread.currentThread()+" acquired lock "+lock+" for sbb entity with id "+sbbeId); } } }
/** * Resumes the specified tx. If it is null nothing is done. * @param transaction * @throws SLEEException if there is a system error in tx manager */ void resumeTransaction(SleeTransaction transaction) throws SLEEException { if (transaction != null) { try { txManager.resume(transaction); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } } } }
/** * TODO * @param profileAttrArrayValueClass * @return */ private static ProfileEntityArrayAttributeValue newProfileEntityArrayAttributeValueInstance( Class<?> profileAttrArrayValueClass,ProfileEntity owner) { ProfileEntityArrayAttributeValue profileAttrArrayValue = null; try { profileAttrArrayValue = (ProfileEntityArrayAttributeValue) profileAttrArrayValueClass .newInstance(); profileAttrArrayValue.setProfileEntity(owner); } catch (Throwable e) { throw new SLEEException(e.getMessage(), e); } return profileAttrArrayValue; }
/** * Process a {@link PrivilegedActionException} occurred when invoking a method in the custom local object interface. * @param e * @throws Exception * @throws TransactionRolledbackLocalException */ protected void processPrivilegedActionException(PrivilegedActionException e) throws Exception, TransactionRolledbackLocalException { if (e.getCause() instanceof RuntimeException) { processRuntimeException((RuntimeException) e.getCause()); } else if (e.getCause() instanceof Exception) { throw (Exception) e.getCause(); } else { throw new SLEEException("unexpected type of cause",e.getCause()); } }
/** * * Sets the directory that will be used for unpacking the child jars for a given DU. * @TODO: make sure to remove the temp directory on undeploy * * @param jarName The name of the jarFile which will be used as component in the temp deployment dir name * @throws IOException if the temp dir cannot be created */ private File createTempDUJarsDeploymentDir(File rootDir, URL sourceUrl) { String jarName = new File(sourceUrl.getFile()).getName(); try { // first create a dummy file to gurantee uniqueness. I would have been nice if the File class had a createTempDir() method // IVELIN -- do not use jarName here because windows cannot see the path (exceeds system limit) File tempDeploymentFile = File.createTempFile("tmpDUJars", "", rootDir); File tempDUJarsDeploymentDir = new File(tempDeploymentFile.getAbsolutePath() + "-contents"); if (!tempDUJarsDeploymentDir.exists()) tempDUJarsDeploymentDir.mkdirs(); tempDeploymentFile.delete(); return tempDUJarsDeploymentDir; } catch (IOException e) { logger.error("Temp Deployment Directory could not be created for SLEE DU: " + jarName); throw new SLEEException("Failed to create temp deployment dir", e); } }
public void uninstall() { synchronized (this) { Transaction tx = null; try { tx = sleeTransactionManager.suspend(); } catch (Throwable e) { throw new SLEEException(e.getMessage(), e); } if (entityManagerFactory != null) { entityManagerFactory.close(); } try { sleeTransactionManager.resume(tx); } catch (Throwable e) { throw new SLEEException(e.getMessage(), e); } //component.setProfileEntityFramework(null); } }
/** * * If there are bind calls to ENC, replace with * OperationNotSupportedException exception. * * Required by SLEE 1.0 spec. * * @see com.opencloud.sleetck.lib.testsuite.sbb.abstractclass.Test522Test * */ private void decorateENCBindCalls() { Iterator iter = concreteMethods.values().iterator(); while (iter.hasNext()) { CtMethod method = (CtMethod) iter.next(); try { trapMethodIfENCBindCall(method); } catch (CannotCompileException e) { throw new SLEEException( "Could not decorate ENC bind calls for sbb abstract class: " + sbbAbstractClass, e); } } }
/** * * If there are bind calls to ENC, replace with * OperationNotSupportedException exception. * * Required by SLEE 1.0 spec. * * @see com.opencloud.sleetck.lib.testsuite.sbb.abstractclass.Test522Test * */ private void decorateENCBindCalls() { Iterator iter = concreteMethods.values().iterator(); while (iter.hasNext()) { CtMethod method = (CtMethod) iter.next(); try { trapMethodIfENCBindCall(method); } catch (CannotCompileException e) { throw new SLEEException( "Could not decorate ENC bind calls for sbb abstract class: " + sbbAbstractClass, e); } } }
/** * Retrieves the profile cmp slee 1.0 wrapper for this profile object * @return */ public AbstractProfileCmpSlee10Wrapper getProfileCmpSlee10Wrapper() { if (profileCmpSlee10Wrapper == null) { try { profileCmpSlee10Wrapper = (AbstractProfileCmpSlee10Wrapper) profileTable.getProfileSpecificationComponent().getProfileCmpSlee10WrapperClass().getConstructor(ProfileObjectImpl.class).newInstance(this); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } } return profileCmpSlee10Wrapper; }
private ProfileTableImpl createProfileTableInstance(String profileTableName, ProfileSpecificationComponent component) { if (component.getProfileTableConcreteClass() == null) { return new ProfileTableImpl(profileTableName, component, this); } else { try { return (ProfileTableImpl)component.getProfileTableConcreteClass().getConstructor(String.class, ProfileSpecificationComponent.class, ProfileManagementImpl.class).newInstance(profileTableName, component, this); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } } }