Package org.apache.abdera.protocol.server

Examples of org.apache.abdera.protocol.server.CollectionAdapter


        if (processor == null) {
            return ProviderHelper.notfound(request);
        }

        WorkspaceManager wm = getWorkspaceManager(request);
        CollectionAdapter adapter = wm.getCollectionAdapter(request);
        Transactional transaction = adapter instanceof Transactional ? (Transactional) adapter : null;
        ResponseContext response = null;
        try {
            transactionStart(transaction, request);
            response = processor.process(request, wm, adapter);
View Full Code Here


  protected static synchronized CollectionAdapter createAdapterInstance(
    FeedConfiguration config,
    Abdera abdera)
      throws Exception {
    CollectionAdapter basicAdapter = adapterInstanceMap.get(config.getFeedId());
    if (basicAdapter != null) {
      return basicAdapter;
    }
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Class<?> adapterClass = cl.loadClass(config.getAdapterClassName());
    Constructor<?>[] ctors = adapterClass.getConstructors();
    for (Constructor<?> element : ctors) {
      logger.finest("Public constructor found: " +
        element.toString());
    }
    Constructor<?> c =
      adapterClass.getConstructor(
        new Class[] {
          Abdera.class,
          FeedConfiguration.class});
    c.setAccessible(true);
    CollectionAdapter adapterInstance =
      (CollectionAdapter) c.newInstance(
        abdera, config);

    // put this adapter instance in adapterInstanceMap
    adapterInstanceMap.put(config.getFeedId(), adapterInstance);
View Full Code Here

    }
    return null;
  }
 
  private Target getTarget(RequestContext context, RouteTargetType target, String uri) {
    CollectionAdapter ca = route2CA.get(target.route);
      if (ca != null) {
        context.setAttribute(DefaultWorkspaceManager.COLLECTION_ADAPTER_ATTRIBUTE, ca);
      }
      return getTarget(context, target.route, uri, target.targetType);
  }
View Full Code Here

  public CollectionAdapter getCollectionAdapter(RequestContext request) {
    String path = request.getContextPath() + request.getTargetPath();
   
    // Typically this happens when a Resolver wants to override the CollectionAdapter being used
    CollectionAdapter ca = (CollectionAdapter) request.getAttribute(Scope.REQUEST, COLLECTION_ADAPTER_ATTRIBUTE);
    if (ca != null) {
      return ca;
    }
    for (WorkspaceInfo wi : workspaces) {
      for (CollectionInfo ci : wi.getCollections(request)) {
View Full Code Here

        if (processor == null) {
            return ProviderHelper.notfound(request);
        }

        WorkspaceManager wm = getWorkspaceManager(request);
        CollectionAdapter adapter = wm.getCollectionAdapter(request);
        Transactional transaction = adapter instanceof Transactional ? (Transactional)adapter : null;
        ResponseContext response = null;
        try {
            transactionStart(transaction, request);
            response = processor.process(request, wm, adapter);
View Full Code Here

        }
        return null;
    }

    private Target getTarget(RequestContext context, RouteTargetType target, String uri) {
        CollectionAdapter ca = route2CA.get(target.route);
        if (ca != null) {
            context.setAttribute(DefaultWorkspaceManager.COLLECTION_ADAPTER_ATTRIBUTE, ca);
        }
        return getTarget(context, target.route, uri, target.targetType);
    }
View Full Code Here

    public CollectionAdapter getCollectionAdapter(RequestContext request) {
        String path = request.getContextPath() + request.getTargetPath();

        // Typically this happens when a Resolver wants to override the CollectionAdapter being used
        CollectionAdapter ca = (CollectionAdapter)request.getAttribute(Scope.REQUEST, COLLECTION_ADAPTER_ATTRIBUTE);
        if (ca != null) {
            return ca;
        }
        for (WorkspaceInfo wi : workspaces) {
            for (CollectionInfo ci : wi.getCollections(request)) {
View Full Code Here

        return config.loadFeedConfiguration(feedId);
    }

    protected static synchronized CollectionAdapter createAdapterInstance(FeedConfiguration config, Abdera abdera)
        throws Exception {
        CollectionAdapter basicAdapter = adapterInstanceMap.get(config.getFeedId());
        if (basicAdapter != null) {
            return basicAdapter;
        }
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Class<?> adapterClass = cl.loadClass(config.getAdapterClassName());
        Constructor<?>[] ctors = adapterClass.getConstructors();
        for (Constructor<?> element : ctors) {
            logger.finest("Public constructor found: " + element.toString());
        }
        Constructor<?> c = adapterClass.getConstructor(new Class[] {Abdera.class, FeedConfiguration.class});
        c.setAccessible(true);
        CollectionAdapter adapterInstance = (CollectionAdapter)c.newInstance(abdera, config);

        // put this adapter instance in adapterInstanceMap
        adapterInstanceMap.put(config.getFeedId(), adapterInstance);
        return adapterInstance;
    }
View Full Code Here

        if (processor == null) {
            return ProviderHelper.notfound(request);
        }

        WorkspaceManager wm = getWorkspaceManager(request);
        CollectionAdapter adapter = wm.getCollectionAdapter(request);
        Transactional transaction = adapter instanceof Transactional ? (Transactional) adapter
                : null;
        ResponseContext response = null;
        try {
            transactionStart(transaction, request);
View Full Code Here

    if (idx != -1) {
      uri = uri.substring(0, idx);
    }
    for(Map.Entry<Route, TargetType> entry : targets.entrySet()) {
      if (entry.getKey().match(uri)) {
        CollectionAdapter ca = route2CA.get(entry.getKey());
        if (ca != null) {
          context.setAttribute(DefaultWorkspaceManager.COLLECTION_ADAPTER_ATTRIBUTE, ca);
        }
        return getTarget(context, entry.getKey(), uri, entry.getValue());
      }
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.CollectionAdapter

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.