Package org.fcrepo.server

Examples of org.fcrepo.server.Context


                                         @QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format,
                                         @QueryParam(RestParam.VALIDATE_CHECKSUM) @DefaultValue("false") boolean validateChecksum,
                                         @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) {
        try {
            Date asOfDateTime = DateUtility.parseDateOrNull(dateTime);
            Context context = getContext();
            Datastream dsProfile =
                    m_management.getDatastream(context, pid, dsID, asOfDateTime);

            if (dsProfile == null) {
                return Response
View Full Code Here


    public Response getDatastreamHistory(@PathParam(RestParam.PID) String pid,
                                         @PathParam(RestParam.DSID) String dsID,
                                         @QueryParam(RestParam.FORMAT) @DefaultValue(HTML) String format,
                                         @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) {
        try {
            Context context = getContext();
            Datastream[] datastreamHistory =
                    m_management.getDatastreamHistory(context, pid, dsID);

            if (datastreamHistory == null || datastreamHistory.length == 0) {
                return Response
View Full Code Here

    public Response getDatastream(@PathParam(RestParam.PID) String pid,
                                  @PathParam(RestParam.DSID) String dsID,
                                  @QueryParam(RestParam.AS_OF_DATE_TIME) String dateTime,
                                  @QueryParam(RestParam.DOWNLOAD) String download,
                                  @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) {
        Context context = getContext();
        try {
            Date asOfDateTime = DateUtility.parseDateOrNull(dateTime);
            MIMETypedStream stream =
                    m_access.getDatastreamDissemination(context,
                                                           pid,
View Full Code Here

                                     @QueryParam(RestParam.END_DT) String endDT,
                                     @QueryParam(RestParam.LOG_MESSAGE) String logMessage,
                                     @QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) {

        try {
            Context context = getContext();
            Date startDate = DateUtility.parseDateOrNull(startDT);
            Date endDate = DateUtility.parseDateOrNull(endDT);
            Date[] purged = m_management.purgeDatastream(context,
                                        pid,
                                        dsID,
View Full Code Here

            if (altIDList != null && altIDList.size() > 0) {
                altIDs = altIDList.toArray(new String[altIDList.size()]);
            }

            Context context = getContext();

            Datastream existingDS =
                    m_management.getDatastream(context, pid, dsID, null);
            if (!posted && versionable == null && existingDS != null){
                versionable = existingDS.DSVersionable;
View Full Code Here

            }
            String targetRole = //Authorization.FEDORA_ROLE_KEY + "=" +
                    dm.callbackRole; // restrict access to role of this
            // ticket
            String[] targetRoles = {targetRole};
            Context context =
                    ReadOnlyContext.getContext(Constants.HTTP_REQUEST.REST.uri,
                                               request); // , targetRoles);
            if (request.getRemoteUser() == null) {
                // non-authn: must accept target role of ticket
                logger.debug("DatastreamResolverServlet: unAuthenticated request");
            } else {
                // authn: check user roles for target role of ticket
                /*
                 * logger.debug("DatastreamResolverServlet: Authenticated request
                 * getting user"); String[] roles = null; Principal principal =
                 * request.getUserPrincipal(); if (principal == null) { // no
                 * principal to grok roles from!! } else { try { roles =
                 * ReadOnlyContext.getRoles(principal); } catch (Throwable t) { } }
                 * if (roles == null) { roles = new String[0]; }
                 */
                //XXXXXXXXXXXXXXXXXXXXXXxif (contains(roles, targetRole)) {
                logger.debug("DatastreamResolverServlet: user=="
                        + request.getRemoteUser());
                /*
                 * if
                 * (((ExtendedHttpServletRequest)request).isUserInRole(targetRole)) {
                 * logger.debug("DatastreamResolverServlet: user has required
                 * role"); } else { logger.debug("DatastreamResolverServlet: authZ
                 * exception in validating user"); throw new
                 * AuthzDeniedException("wrong user for this ticket"); }
                 */
            }

            if (logger.isDebugEnabled()) {
                logger.debug("debugging backendService role");
                logger.debug("targetRole=" + targetRole);
                int targetRolesLength = targetRoles.length;
                logger.debug("targetRolesLength=" + targetRolesLength);
                if (targetRolesLength > 0) {
                    logger.debug("targetRoles[0]=" + targetRoles[0]);
                }
                int nSubjectValues = context.nSubjectValues(targetRole);
                logger.debug("nSubjectValues=" + nSubjectValues);
                if (nSubjectValues > 0) {
                    logger.debug("context.getSubjectValue(targetRole)="
                            + context.getSubjectValue(targetRole));
                }
                Iterator it = context.subjectAttributes();
                while (it.hasNext()) {
                    String name = (String) it.next();
                    int n = context.nSubjectValues(name);
                    switch (n) {
                        case 0:
                            logger.debug("no subject attributes for " + name);
                            break;
                        case 1:
                            String value = context.getSubjectValue(name);
                            logger.debug("single subject attributes for " + name
                                    + "=" + value);
                            break;
                        default:
                            String[] values = context.getSubjectValues(name);
                            for (String element : values) {
                                logger
                                        .debug("another subject attribute from context "
                                                + name + "=" + element);
                            }
                    }
                }
                it = context.environmentAttributes();
                while (it.hasNext()) {
                    String name = (String) it.next();
                    String value = context.getEnvironmentValue(name);
                    logger.debug("another environment attribute from context "
                            + name + "=" + value);
                }
            }
            /*
 
View Full Code Here

                    + request.getParameter("format") + "\n" + "  flush: "
                    + request.getParameter("flush") + "\n" + "  dumbTypes: "
                    + request.getParameter("dumbTypes") + "\n");
        }
        try {
            Context context =
                    ReadOnlyContext.getContext(Constants.HTTP_REQUEST.REST.uri,
                            request);
            m_authorization.enforceRIFindObjects(context);
            doSearch(server, request, response);
        } catch (AuthzException e) {
View Full Code Here

            throws ServletException, IOException {
        boolean xml = false;
        int numPIDs = 1;
        String namespace = null;

        Context context =
                ReadOnlyContext.getContext(HTTP_REQUEST.REST.uri, request);

        // Get optional supplied parameters.
        for (Enumeration<?> e = request.getParameterNames(); e.hasMoreElements();) {
            String name = URLDecoder.decode((String) e.nextElement(), "UTF-8");
View Full Code Here

    }

    private Response getObjectMethodsForSDefImpl(String pid, String sDef, String dTime, String format, boolean flash) {
        try {
            Date asOfDateTime = DateUtility.parseDateOrNull(dTime);
            Context context = getContext();
            ObjectMethodsDef[] methodDefs = m_access.listMethods(context, pid, asOfDateTime);
            String xml = getSerializer(context).objectMethodsToXml(methodDefs, pid, sDef, asOfDateTime);

            MediaType mime = RestHelper.getContentType(format);
View Full Code Here

        if (request.getParameter("xml") != null) {
            xml = new Boolean(request.getParameter("xml")).booleanValue();
        }

        try {
            Context context =
                    ReadOnlyContext.getContext(HTTP_REQUEST.REST.uri, request);
            listMethods(context, PID, asOfDateTime, xml, request, response);
            logger.debug("Finished listing methods");
        } catch (ObjectNotFoundException e) {
            logger.error("Object not found for request: " + requestURI
View Full Code Here

TOP

Related Classes of org.fcrepo.server.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.