-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#8: crce-webui module moved to core, version increased to 2.1.2-SNAPS…
…HOT.
- Loading branch information
1 parent
9bd1377
commit a0b3a69
Showing
72 changed files
with
3,560 additions
and
3,521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
160 changes: 80 additions & 80 deletions
160
...kiv/crce/webui/internal/CheckServlet.java → ...kiv/crce/webui/internal/CheckServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,80 @@ | ||
package cz.zcu.kiv.crce.webui.internal; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
//import cz.zcu.kiv.crce.metadata.Resolver; | ||
import cz.zcu.kiv.crce.metadata.Resource; | ||
//import cz.zcu.kiv.crce.metadata.ResourceCreator; | ||
|
||
public class CheckServlet extends HttpServlet { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(CheckServlet.class); | ||
|
||
private static final long serialVersionUID = -6116518932972052481L; | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
List<Resource> res = chooseFrom(req); | ||
if (res == null) { | ||
req.getRequestDispatcher("resource").forward(req, resp); | ||
} else { | ||
String source = (String) req.getSession().getAttribute("source"); | ||
req.getSession().setAttribute(source, res); | ||
req.getSession().removeAttribute("source"); | ||
req.getRequestDispatcher("jsp/" + source + ".jsp").forward(req, resp); | ||
} | ||
|
||
} | ||
|
||
private List<Resource> chooseFrom(HttpServletRequest req) { | ||
String source = (String) req.getSession().getAttribute("source"); | ||
if (source == null) { | ||
return null; | ||
} else if (source.equals("buffer")) { | ||
return doCheck(Activator.instance().getBuffer(req).getResources()); | ||
} else if (source.equals("store")) { | ||
return doCheck(Activator.instance().getStore(null).getResources()); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
private List<Resource> doCheck(List<Resource> resources) { | ||
logger.warn("Resolver is not designed yet in new Metadata API, returning empty list of resources. Checked resource: {}", resources); | ||
// Resource[] resources = repository.getResources(); | ||
// Resource[] cloned = new Resource[resources.length]; | ||
// System.arraycopy(resources, 0, cloned, 0, resources.length); | ||
// ArrayList<Resource> ext = new ArrayList<>(); | ||
// HashMap<URI, Resource> extMap = new HashMap<>(); | ||
// ResourceCreator rc = Activator.instance().getCreator(); | ||
// Resolver resolver = rc.createResolver(repository); | ||
// for (Resource r : cloned) { | ||
// resolver.add(r); | ||
// r.getUri(); | ||
// extMap.put(r.getUri(), new ResourceExt(r)); | ||
// ext.add(new ResourceExt(r)); | ||
// } | ||
// if (!resolver.resolve()) { | ||
// for (Reason r : resolver.getUnsatisfiedRequirements()) { | ||
// if (extMap.containsKey(r.getResource().getUri())) { | ||
// extMap.get(r.getResource().getUri()).addRequirement(r.getRequirement()); | ||
// } | ||
// | ||
// } | ||
// return extMap.values().toArray(new Resource[extMap.values().size()]); | ||
// } else { | ||
// return resources; | ||
// } | ||
return Collections.emptyList(); | ||
} | ||
} | ||
package cz.zcu.kiv.crce.webui.internal; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
//import cz.zcu.kiv.crce.metadata.Resolver; | ||
import cz.zcu.kiv.crce.metadata.Resource; | ||
//import cz.zcu.kiv.crce.metadata.ResourceCreator; | ||
|
||
public class CheckServlet extends HttpServlet { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(CheckServlet.class); | ||
|
||
private static final long serialVersionUID = -6116518932972052481L; | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
List<Resource> res = chooseFrom(req); | ||
if (res == null) { | ||
req.getRequestDispatcher("resource").forward(req, resp); | ||
} else { | ||
String source = (String) req.getSession().getAttribute("source"); | ||
req.getSession().setAttribute(source, res); | ||
req.getSession().removeAttribute("source"); | ||
req.getRequestDispatcher("jsp/" + source + ".jsp").forward(req, resp); | ||
} | ||
|
||
} | ||
|
||
private List<Resource> chooseFrom(HttpServletRequest req) { | ||
String source = (String) req.getSession().getAttribute("source"); | ||
if (source == null) { | ||
return null; | ||
} else if (source.equals("buffer")) { | ||
return doCheck(Activator.instance().getBuffer(req).getResources()); | ||
} else if (source.equals("store")) { | ||
return doCheck(Activator.instance().getStore(null).getResources()); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
private List<Resource> doCheck(List<Resource> resources) { | ||
logger.warn("Resolver is not designed yet in new Metadata API, returning empty list of resources. Checked resource: {}", resources); | ||
// Resource[] resources = repository.getResources(); | ||
// Resource[] cloned = new Resource[resources.length]; | ||
// System.arraycopy(resources, 0, cloned, 0, resources.length); | ||
// ArrayList<Resource> ext = new ArrayList<>(); | ||
// HashMap<URI, Resource> extMap = new HashMap<>(); | ||
// ResourceCreator rc = Activator.instance().getCreator(); | ||
// Resolver resolver = rc.createResolver(repository); | ||
// for (Resource r : cloned) { | ||
// resolver.add(r); | ||
// r.getUri(); | ||
// extMap.put(r.getUri(), new ResourceExt(r)); | ||
// ext.add(new ResourceExt(r)); | ||
// } | ||
// if (!resolver.resolve()) { | ||
// for (Reason r : resolver.getUnsatisfiedRequirements()) { | ||
// if (extMap.containsKey(r.getResource().getUri())) { | ||
// extMap.get(r.getResource().getUri()).addRequirement(r.getRequirement()); | ||
// } | ||
// | ||
// } | ||
// return extMap.values().toArray(new Resource[extMap.values().size()]); | ||
// } else { | ||
// return resources; | ||
// } | ||
return Collections.emptyList(); | ||
} | ||
} |
Oops, something went wrong.