javax.interceptor.Interceptors Java Examples

The following examples show how to use javax.interceptor.Interceptors. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModificationCacheBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/getMutableFieldList")
@GZIP
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public List<MutableFieldListResponse> getMutableFieldList() {
    List<MutableFieldListResponse> lists = new ArrayList<>();
    for (Entry<String,Set<String>> entry : this.cache.entrySet()) {
        MutableFieldListResponse r = new MutableFieldListResponse();
        r.setDatatype(entry.getKey());
        r.setMutableFields(entry.getValue());
        lists.add(r);
    }
    return lists;
}
 
Example #2
Source File: MapReduceStatusUpdateBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * This method is meant to be a callback from the Hadoop infrastructure and is not protected. When a BulkResults job is submitted the
 * "job.end.notification.url" property is set to public URL endpoint for this servlet. The Hadoop infrastructure will call back to this servlet. If the call
 * back fails for some reason, then Hadoop will retry for the number of configured attempts (job.end.retry.attempts) at some configured interval
 * (job.end.retry.interval)
 *
 * @param jobId
 * @param jobStatus
 *
 * @HTTP 200 success
 * @HTTP 500 failure
 *
 * @return datawave.webservice.result.VoidResponse
 * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
 *
 */
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@Path("/updateState")
@PermitAll
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
public VoidResponse updateState(@Required("jobId") @QueryParam("jobId") String jobId, @Required("jobStatus") @QueryParam("jobStatus") String jobStatus) {
    log.info("Received MapReduce status update for job: " + jobId + ", new status: " + jobStatus);
    
    VoidResponse response = new VoidResponse();
    try {
        mapReduceState.updateState(jobId, MapReduceState.valueOf(jobStatus));
        return response;
    } catch (Exception e) {
        QueryException qe = new QueryException(DatawaveErrorCode.MAPRED_UPDATE_STATUS_ERROR, e);
        log.error(qe);
        response.addException(qe.getBottomQueryException());
        throw new DatawaveWebApplicationException(qe, response);
    }
}
 
Example #3
Source File: ModelBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Delete field mappings from an existing model
 *
 * @param model
 *            list of field mappings to delete
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 500 internal server error
 */
@DELETE
@Consumes({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml"})
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/delete")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors(ResponseInterceptor.class)
public VoidResponse deleteMapping(datawave.webservice.model.Model model, @QueryParam("modelTableName") String modelTableName) {
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    return deleteMapping(model, modelTableName, true);
}
 
Example #4
Source File: ModelBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Copy a model
 *
 * @param name
 *            model to copy
 * @param newName
 *            name of copied model
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 204 model not found
 * @HTTP 500 internal server error
 */
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/clone")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public VoidResponse cloneModel(@Required("name") @FormParam("name") String name, @Required("newName") @FormParam("newName") String newName,
                @FormParam("modelTableName") String modelTableName) {
    VoidResponse response = new VoidResponse();
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    datawave.webservice.model.Model model = getModel(name, modelTableName);
    // Set the new name
    model.setName(newName);
    importModel(model, modelTableName);
    return response;
}
 
Example #5
Source File: ModelBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Delete a model with the supplied name
 *
 * @param name
 *            model name to delete
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 404 model not found
 * @HTTP 500 internal server error
 */
@DELETE
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{name}")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public VoidResponse deleteModel(@Required("name") @PathParam("name") String name, @QueryParam("modelTableName") String modelTableName) {
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    return deleteModel(name, modelTableName, true);
}
 
Example #6
Source File: CachedResultsBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml"})
@javax.ws.rs.Path("/async/load")
@GenerateQuerySessionId(cookieBasePath = "/DataWave/CachedResults/")
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
@Asynchronous
public void loadAsync(@QueryParam("queryId") @Required("queryId") String queryId, @QueryParam("alias") String alias, @Suspended AsyncResponse asyncResponse) {
    
    String nameBase = UUID.randomUUID().toString().replaceAll("-", "");
    CreateQuerySessionIDFilter.QUERY_ID.set(queryId);
    try {
        GenericResponse<String> response = load(queryId, alias, nameBase);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #7
Source File: CachedResultsBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public Future<CachedResultsResponse> loadAndCreateAsync(@Required("newQueryId") String newQueryId, String alias, @Required("queryId") String queryId,
                @Required("fields") String fields, String conditions, String grouping, String order, @Required("columnVisibility") String columnVisibility,
                @DefaultValue("-1") Integer pagesize, String fixedFieldsInEvent) {
    
    MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<>();
    queryParameters.putSingle(CachedResultsParameters.QUERY_ID, queryId);
    queryParameters.putSingle("newQueryId", newQueryId);
    queryParameters.putSingle(CachedResultsParameters.ALIAS, alias);
    queryParameters.putSingle(CachedResultsParameters.FIELDS, fields);
    queryParameters.putSingle(CachedResultsParameters.CONDITIONS, conditions);
    queryParameters.putSingle(CachedResultsParameters.GROUPING, grouping);
    queryParameters.putSingle(CachedResultsParameters.ORDER, order);
    queryParameters.putSingle("columnVisibility", columnVisibility);
    queryParameters.putSingle(QueryParameters.QUERY_PAGESIZE, Integer.toString(pagesize));
    queryParameters.putSingle(CachedResultsParameters.FIXED_FIELDS_IN_EVENT, fixedFieldsInEvent);
    
    return loadAndCreateAsync(queryParameters);
}
 
Example #8
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces("*/*")
@Path("/{logicName}/async/execute")
@GZIP
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Asynchronous
@Timed(name = "dw.query.executeQueryAsync", absolute = true)
public void executeAsync(@PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters, @Context HttpHeaders httpHeaders,
                @Suspended AsyncResponse asyncResponse) {
    try {
        StreamingOutput output = execute(logicName, queryParameters, httpHeaders);
        asyncResponse.resume(output);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #9
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/purgeQueryCache")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@Interceptors(ResponseInterceptor.class)
@RolesAllowed("Administrator")
public VoidResponse purgeQueryCache() {
    VoidResponse response = new VoidResponse();
    try {
        queryCache.clear();
        return response;
    } catch (Exception e) {
        QueryException qe = new QueryException(DatawaveErrorCode.QUERY_CACHE_PURGE_ERROR, e);
        log.error(qe, e);
        response.addException(qe.getBottomQueryException());
        int statusCode = qe.getBottomQueryException().getStatusCode();
        throw new DatawaveWebApplicationException(qe, response, statusCode);
    }
}
 
Example #10
Source File: OperatorServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@RolesAllowed("PLATFORM_OPERATOR")
@Interceptors({ ServiceProviderInterceptor.class })
public void resetPasswordForUser(String userId)
        throws ObjectNotFoundException, OperationNotPermittedException,
        MailOperationException, OrganizationAuthoritiesException {

    // retrieve the platform user
    PlatformUser user = new PlatformUser();
    user.setUserId(userId);
    user = (PlatformUser) dm.getReferenceByBusinessKey(user);

    // reset the password, no marketplace context available
    im.resetPasswordForUser(user, null);

}
 
Example #11
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/{id}/async/next")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@EnrichQueryMetrics(methodType = MethodType.NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Asynchronous
@Timed(name = "dw.query.nextAsync", absolute = true)
public void nextAsync(@Required("id") @PathParam("id") String id, @Suspended AsyncResponse asyncResponse) {
    try {
        BaseQueryResponse response = next(id);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #12
Source File: IdentityServiceBean.java    From development with Apache License 2.0 6 votes vote down vote up
@Override
@RolesAllowed("ORGANIZATION_ADMIN")
@Interceptors({ ServiceProviderInterceptor.class })
public void requestResetOfUserPassword(VOUser user, String marketplaceId)
        throws MailOperationException, ObjectNotFoundException,
        OperationNotPermittedException, UserActiveException,
        ConcurrentModificationException {

    ArgumentValidator.notNull("user", user);
    PlatformUser platformUser = getPlatformUser(user.getUserId(),
            user.getTenantId(), true);
    BaseAssembler.verifyVersionAndKey(platformUser, user);

    resetUserPassword(platformUser, marketplaceId);

}
 
Example #13
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{logicName}/async/createAndNext")
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@EnrichQueryMetrics(methodType = MethodType.CREATE_AND_NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Asynchronous
@Timed(name = "dw.query.createAndNextAsync", absolute = true)
public void createQueryAndNextAsync(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters,
                @Suspended AsyncResponse asyncResponse) {
    try {
        BaseQueryResponse response = createQueryAndNext(logicName, queryParameters);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #14
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{logicName}/createAndNext")
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@EnrichQueryMetrics(methodType = MethodType.CREATE_AND_NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Timed(name = "dw.query.createAndNext", absolute = true)
public BaseQueryResponse createQueryAndNext(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters,
                @Context HttpHeaders httpHeaders) {
    CreateQuerySessionIDFilter.QUERY_ID.set(null);
    
    GenericResponse<String> createResponse = createQuery(logicName, queryParameters, httpHeaders);
    String queryId = createResponse.getResult();
    CreateQuerySessionIDFilter.QUERY_ID.set(queryId);
    return next(queryId, false);
}
 
Example #15
Source File: ModificationBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a list of the Modification service names and their configurations
 *
 * @return datawave.webservice.results.modification.ModificationConfigurationResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 * @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
 * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
 */
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/listConfigurations")
@GZIP
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public List<ModificationConfigurationResponse> listConfigurations() {
    List<ModificationConfigurationResponse> configs = new ArrayList<>();
    for (Entry<String,ModificationServiceConfiguration> entry : this.modificationConfiguration.getConfigurations().entrySet()) {
        ModificationConfigurationResponse r = new ModificationConfigurationResponse();
        r.setName(entry.getKey());
        r.setRequestClass(entry.getValue().getRequestClass().getName());
        r.setDescription(entry.getValue().getDescription());
        r.setAuthorizedRoles(entry.getValue().getAuthorizedRoles());
        configs.add(r);
    }
    return configs;
}
 
Example #16
Source File: QueryMetricsBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Returns metrics for the current users queries that are identified by the id
 *
 * @param id
 *
 * @return datawave.webservice.result.QueryMetricListResponse
 *
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user, by specifying a chain of DNs of the identities to proxy
 * @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
 * @HTTP 200 success
 * @HTTP 500 internal server error
 */
@GET
@POST
@Path("/id/{id}")
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public BaseQueryMetricListResponse query(@PathParam("id") @Required("id") String id) {
    
    // Find out who/what called this method
    DatawavePrincipal dp = null;
    Principal p = ctx.getCallerPrincipal();
    String user = p.getName();
    if (p instanceof DatawavePrincipal) {
        dp = (DatawavePrincipal) p;
        user = dp.getShortName();
    }
    return queryHandler.query(user, id, dp);
}
 
Example #17
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{logicName}/async/create")
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@EnrichQueryMetrics(methodType = MethodType.CREATE)
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
@Asynchronous
@Timed(name = "dw.query.createQueryAsync", absolute = true)
public void createQueryAsync(@Required("logicName") @PathParam("logicName") String queryLogicName, MultivaluedMap<String,String> queryParameters,
                @Suspended AsyncResponse asyncResponse) {
    try {
        GenericResponse<String> response = createQuery(queryLogicName, queryParameters);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #18
Source File: QueryMetricsBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@GET
@POST
@Path("/id/{id}/map")
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public QueryGeometryResponse map(@PathParam("id") @Required("id") String id) {
    
    // Find out who/what called this method
    DatawavePrincipal dp = null;
    Principal p = ctx.getCallerPrincipal();
    String user = p.getName();
    if (p instanceof DatawavePrincipal) {
        dp = (DatawavePrincipal) p;
        user = dp.getShortName();
    }
    
    return queryGeometryHandler.getQueryGeometryResponse(id, queryHandler.query(user, id, dp).getResult());
}
 
Example #19
Source File: InvocationDateContainerTest.java    From development with Apache License 2.0 5 votes vote down vote up
private static boolean hasInterceptor(Class<?> clazz,
        Class<?> interceptorClass) {
    Interceptors annotation = clazz.getAnnotation(Interceptors.class);
    if (annotation != null) {
        for (Class<?> currentInterceptorClazz : annotation.value()) {
            if (interceptorClass.equals(currentInterceptorClazz)) {
                return true;
            }
        }
    }
    return false;
}
 
Example #20
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 5 votes vote down vote up
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/lookupUUID/{uuidType}/{uuid}")
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
@Override
@Timed(name = "dw.query.lookupUUID", absolute = true)
public <T> T lookupUUID(@Required("uuidType") @PathParam("uuidType") String uuidType, @Required("uuid") @PathParam("uuid") String uuid,
                @Context UriInfo uriInfo, @Required("httpHeaders") @Context HttpHeaders httpHeaders) {
    MultivaluedMapImpl<String,String> queryParameters = new MultivaluedMapImpl<>();
    queryParameters.putAll(uriInfo.getQueryParameters());
    return this.lookupUUID(uuidType, uuid, queryParameters, httpHeaders);
}
 
Example #21
Source File: StatelessInterceptorTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Interceptors({EchoMethodInterceptorViaAnn.class})
@ExcludeClassInterceptors
@ExcludeDefaultInterceptors
public boolean echo(final boolean i) {
    calls.add(Call.Bean_Invoke);
    return i;
}
 
Example #22
Source File: StatelessInterceptorTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Interceptors({EchoMethodInterceptorViaAnn.class})
@ExcludeClassInterceptors
@ExcludeDefaultInterceptors
public boolean echo(final boolean i) {
    calls.add(Call.Bean_Invoke);
    return i;
}
 
Example #23
Source File: SecondStatelessInterceptedBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Interceptors({MethodLevelInterceptorOne.class, MethodLevelInterceptorTwo.class})
public List<String> methodWithDefaultInterceptorsExcluded() {
    final List<String> list = new ArrayList<>();
    list.add("methodWithDefaultInterceptorsExcluded");
    return list;

}
 
Example #24
Source File: CoffeePurchaser.java    From Architecting-Modern-Java-EE-Applications with MIT License 5 votes vote down vote up
@Interceptors(FailureToNullInterceptor.class)
public OrderId purchaseBeans(BeanType type) {
    // construct purchase payload from type
    // ...
    Purchase purchase = new Purchase();

    CoffeeOrder coffeeOrder = target
            .request(MediaType.APPLICATION_JSON_TYPE)
            .post(Entity.json(purchase))
            .readEntity(CoffeeOrder.class);

    return coffeeOrder.getId();
}
 
Example #25
Source File: SecondStatelessInterceptedBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Interceptors({MethodLevelInterceptorOne.class, MethodLevelInterceptorTwo.class})
public List<String> methodWithDefaultInterceptorsExcluded() {
    List<String> list = new ArrayList<String>();
    list.add("methodWithDefaultInterceptorsExcluded");
    return list;

}
 
Example #26
Source File: ThirdSLSBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Interceptors({MethodLevelInterceptorOne.class, MethodLevelInterceptorTwo.class})
@ExcludeClassInterceptors
public List<String> anotherBusinessMethod() {
    final List<String> list = new ArrayList<>();
    list.add("anotherBusinessMethod");
    return list;
}
 
Example #27
Source File: BesMatchers.java    From development with Apache License 2.0 5 votes vote down vote up
public static Matcher<Class<?>> containsInterceptor(final Class<?> beanClass) {
    return new BaseMatcher<Class<?>>() {
        private Class<?> testClass;

        @Override
        public boolean matches(Object object) {
            testClass = (Class<?>) object;
            Interceptors interceptors = testClass
                    .getAnnotation(Interceptors.class);

            boolean interceptorSet = false;
            if (interceptors != null) {
                for (Class<?> definedInterceptorClass : interceptors
                        .value()) {
                    if (definedInterceptorClass == beanClass) {
                        interceptorSet = true;
                    }
                }
            }

            assertTrue(interceptorSet);
            return true;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("Class " + testClass.getName()
                    + " has no interceptor " + beanClass.getName());
        }
    };
}
 
Example #28
Source File: StatelessInterceptedBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
/**
 * A simple dummy busines method to reverse a string
 *
 * @see org.apache.openejb.test.stateless.BasicStatelessInterceptedLocal#reverse(java.lang.String)
 */
@Interceptors({MethodInterceptor.class})
public String reverse(final String str) {
    if (str.length() > 0) {
        throw new NullPointerException();
    }
    final StringBuffer b = new StringBuffer(str);
    return b.reverse().toString();
}
 
Example #29
Source File: IdentityServiceBean.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
@Interceptors({ ServiceProviderInterceptor.class })
public boolean searchLdapUsersOverLimit(final String userIdPattern)
        throws ValidationException {
    ArgumentValidator.notNull("userIdPattern", userIdPattern);

    Organization organization = dm.getCurrentUser().getOrganization();

    LdapConnector connector = getLdapConnectionForOrganization(
            organization);
    Properties dirProperties = connector.getDirProperties();
    Map<SettingType, String> attrMap = connector.getAttrMap();
    String baseDN = connector.getBaseDN();
    ILdapResultMapper<VOUserDetails> mapper = new LdapVOUserDetailsMapper(
            null, attrMap);
    try {
        return ldapAccess.searchOverLimit(dirProperties, baseDN,
                getLdapSearchFilter(attrMap, userIdPattern), mapper, false);
    } catch (NamingException e) {
        Object[] params = new Object[] {
                dirProperties.get(Context.PROVIDER_URL), e.getMessage() };
        ValidationException vf = new ValidationException(
                ReasonEnum.LDAP_CONNECTION_REFUSED, null, params);
        logger.logError(Log4jLogger.SYSTEM_LOG, vf,
                LogMessageIdentifier.ERROR_LDAP_SYSTEM_CONNECTION_REFUSED);
        throw vf;
    }
}
 
Example #30
Source File: ThirdSLSBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Interceptors({MethodLevelInterceptorOne.class, MethodLevelInterceptorTwo.class})
@ExcludeClassInterceptors
public List<String> anotherBusinessMethod() {
    List<String> list = new ArrayList<String>();
    list.add("anotherBusinessMethod");
    return list;
}