List of usage examples for java.util Vector isEmpty
public synchronized boolean isEmpty()
From source file:com.swingtech.commons.util.ClassUtil.java
/** * @param pClass/*from w w w. ja v a2s . c o m*/ * @param filterRegEx * @return */ public static List getPropertyNamesFromClass(final Class pClass, final String filterRegEx) { BeanInfo vBeanInfo = null; PropertyDescriptor vPropDescList[] = null; PropertyDescriptor vPropDesc = null; String vPropName = null; final Vector vPropertyNameList = new Vector(); try { vBeanInfo = Introspector.getBeanInfo(pClass); } catch (final IntrospectionException e) { logger.warn("Utility.getPropertyNamesFromClass. Error trying to use Introspector", e); return null; } vPropDescList = vBeanInfo.getPropertyDescriptors(); for (int i = 0; i < vPropDescList.length; i++) { vPropDesc = vPropDescList[i]; vPropName = vPropDesc.getName(); if (Utility.isNullOrEmpty(filterRegEx) || vPropName.matches(filterRegEx)) { vPropertyNameList.add(vPropName); } } if (vPropertyNameList.isEmpty()) { return null; } return vPropertyNameList; }
From source file:net.gplatform.sudoor.server.cxf.WSAuthenticationInInterceptor.java
@Override public void handleMessage(SoapMessage message) throws Fault { try {/*from w w w . ja v a2 s. c o m*/ super.handleMessage(message); Vector<WSHandlerResult> result = (Vector<WSHandlerResult>) message .getContextualProperty(WSHandlerConstants.RECV_RESULTS); if (result != null && !result.isEmpty()) { for (WSHandlerResult res : result) { // loop through security engine results for (WSSecurityEngineResult securityResult : (Vector<WSSecurityEngineResult>) res .getResults()) { int action = (Integer) securityResult.get(WSSecurityEngineResult.TAG_ACTION); // determine if the action was a username token if ((action & WSConstants.UT) > 0) { // get the principal object WSUsernameTokenPrincipalImpl principal = (WSUsernameTokenPrincipalImpl) securityResult .get(WSSecurityEngineResult.TAG_PRINCIPAL); if (principal.getPassword() == null) { principal.setPassword(""); } SSAuth.authenticate(principal.getName(), principal.getPassword()); } } } } } catch (RuntimeException ex) { logger.error("Error in handleMessage", ex); throw ex; } }
From source file:com.utest.webservice.auth.UtestWSS4JInInterceptor.java
@SuppressWarnings("unchecked") @Override// w w w . ja va 2 s.c o m public void handleMessage(final SoapMessage message) throws Fault { try { super.handleMessage(message); final Vector<WSHandlerResult> result = (Vector<WSHandlerResult>) message .getContextualProperty(WSHandlerConstants.RECV_RESULTS); if ((result != null) && !result.isEmpty()) { for (final WSHandlerResult res : result) { // loop through security engine results for (final WSSecurityEngineResult securityResult : (Vector<WSSecurityEngineResult>) res .getResults()) { final int action = (Integer) securityResult.get(WSSecurityEngineResult.TAG_ACTION); // determine if the action was a username token if ((action & WSConstants.UT) > 0) { // get the principal object final WSUsernameTokenPrincipal principal = (WSUsernameTokenPrincipal) securityResult .get(WSSecurityEngineResult.TAG_PRINCIPAL); if (principal.getPassword() == null) { principal.setPassword(""); } Authentication authentication = new UsernamePasswordAuthenticationToken( principal.getName(), principal.getPassword()); authentication = authenticationProvider.authenticate(authentication); if (!authentication.isAuthenticated()) { System.out.println("This user is not authentic."); } SecurityContextHolder.getContext().setAuthentication(authentication); } } } } } catch (final RuntimeException ex) { ex.printStackTrace(); throw ex; } }
From source file:com.openmeap.json.JSONObjectBuilder.java
private Object[] toTypedArray(Vector list) { if (list.isEmpty()) { return null; }//from w w w .ja v a2 s . c om Object first = list.elementAt(0); Object[] ret = null; if (first instanceof String) { ret = new String[list.size()]; } else if (first instanceof Double) { ret = new Double[list.size()]; } else if (first instanceof Integer) { ret = new Integer[list.size()]; } else if (first instanceof Long) { ret = new Long[list.size()]; } else if (first instanceof Boolean) { ret = new Boolean[list.size()]; } list.copyInto(ret); return (Object[]) ret; }
From source file:org.globus.ftp.test.MlsxTest.java
public void test5() throws Exception { logger.info("test two consective mlsd, using both mlsd functions, using GridFTPClient"); GridFTPClient src = new GridFTPClient(TestEnv.serverAHost, TestEnv.serverAPort); src.setAuthorization(TestEnv.getAuthorization(TestEnv.serverASubject)); src.authenticate(null); // use default creds String output1 = null;/*from w w w . j a va2 s . c o m*/ String output2 = null; // using mlsd() Vector v = src.mlsd(TestEnv.serverADir); logger.debug("mlsd received"); StringBuffer output1Buffer = new StringBuffer(); while (!v.isEmpty()) { MlsxEntry f = (MlsxEntry) v.remove(0); output1Buffer.append(f.toString()).append("\n"); } output1 = output1Buffer.toString(); logger.debug(output1); // using mlsd 2nd time HostPort hp2 = src.setPassive(); src.setLocalActive(); src.changeDir(TestEnv.serverADir); v = src.mlsd(); logger.debug("mlsd received"); StringBuffer output2Buffer = new StringBuffer(); while (!v.isEmpty()) { MlsxEntry f = (MlsxEntry) v.remove(0); output2Buffer.append(f.toString()).append("\n"); } output2 = output2Buffer.toString(); logger.debug(output2); src.close(); }
From source file:no.met.jtimeseries.netcdf.NetcdfChartProvider.java
Vector<NumberPhenomenon> getWantedPhenomena(Iterable<String> variables) throws ParseException { if (variables == null) variables = getVariables();//from www.jav a 2 s. c om Vector<NumberPhenomenon> data = new Vector<NumberPhenomenon>(); for (String variable : variables) data.add(getWantedPhenomenon(variable)); if (data.isEmpty()) throw new ParseException("Unable to find requested parameters", 0); return data; }
From source file:com.brightcove.test.upload.HLS.Encrypted.HLSEncryptionIntegrationTest.java
/** * Verify the SSL support on Rendition URL * @throws MediaAPIError /*w w w .j a v a2 s .c o m*/ */ @Test public void testSSLOnRenditionURL() throws MediaAPIError { setOriginAttributes(mEnvironment, hlsConfig.getAttributesAllRenditionFileSSL()); setGobblesEdgeAttributes(mEnvironment, hlsConfig.getAttributesForSSLGobblesConfig()); Vector rendition = retriveRenditionURL(mAccountInfo, mEnvironment, videoId); if (!rendition.isEmpty()) { AppleStreamingCheck appleCheck = new AppleStreamingCheck(); appleCheck.assertURLAreSSLSecured(rendition); } }
From source file:com.brightcove.test.upload.HLS.Encrypted.HLSEncryptionIntegrationTest.java
/** * Verify the TTL on Rendition Urls// ww w . ja va 2 s .com * @throws MediaAPIError */ @Test public void testTTLOnRendition() throws MediaAPIError { setOriginAttributes(mEnvironment, hlsConfig.getAttributesAllRenditionFileTTL()); setGobblesEdgeAttributes(mEnvironment, hlsConfig.getAttributesForTTLGobblesConfig()); AppleStreamingCheck appleCheck = new AppleStreamingCheck(); Vector rendition = retriveRenditionURL(mAccountInfo, mEnvironment, videoId); if (!rendition.isEmpty()) { appleCheck.assertTTL(rendition); } }
From source file:com.brightcove.test.upload.HLS.Encrypted.HLSEncryptionIntegrationTest.java
/** * Verify the output when ttl on rendition url have expired * @throws MediaAPIError //from w ww . j a v a 2 s . com */ @Test public void testTTLExpirationOnRendition() throws MediaAPIError { setOriginAttributes(mEnvironment, hlsConfig.getAttributesAllRenditionFileTTL()); setGobblesEdgeAttributes(mEnvironment, hlsConfig.getAttributesForTTLGobblesConfig()); Vector rendition = retriveRenditionURL(mAccountInfo, mEnvironment, videoId); if (!rendition.isEmpty()) { AppleStreamingCheck appleCheck = new AppleStreamingCheck(); appleCheck.assertTTLExpiration(rendition); } }
From source file:com.brightcove.test.upload.HLS.Encrypted.HLSEncryptionIntegrationTest.java
/** * Verify the output when TTL are not enabled on origin by enforcement check is enabled on * gobbles and origin//from ww w. j a va2 s .co m * @throws MediaAPIError */ @Test public void testTTLEncforcementCheckOnRendition() throws MediaAPIError { setOriginAttributes(mEnvironment, hlsConfig.getAttributesForTTLEnformentCheckOnRendition()); setGobblesEdgeAttributes(mEnvironment, hlsConfig.getAttributesForTTLGobblesConfig()); Vector rendition = retriveRenditionURL(mAccountInfo, mEnvironment, videoId); if (!rendition.isEmpty()) { AppleStreamingCheck appleCheck = new AppleStreamingCheck(); appleCheck.assetEnforcementCheck(rendition); } }