/******************************************************************************/ /* File: request.beh */ /* */ /* Describes the Request object that represents the structure of the query / */ /* insert request submitted to this process. The components of the request */ /* are extracted from it using a RequestProcessingVisitor that traverses the */ /* structure to construct separate object structures to represent each */ /* individual component. */ /* These components are: */ /* the connection arguments, */ /* the request type (Query / Insert), */ /* the target data structure - table(s) and corresponding column(s), */ /* the generated SQL statement for submitting the request to the DBMS, */ /* the object hierarchy structure requested. */ /* The processing-visitor returns all the components as a vector of objects. */ /* A public accessor method is provided in this class for each component. */ /* */ /******************************************************************************/ Request { {{ private Vector requestDetails = null; public ConnectionArgs getConnectionArgs(ClassGraph cg) { getRequestDetails(cg); return (ConnectionArgs) requestDetails.elementAt(0); } public String getRequestType(ClassGraph cg) { getRequestDetails(cg); return (String) requestDetails.elementAt(1); } public EntityStructure[] getEntityStructure(ClassGraph cg) { getRequestDetails(cg); return (EntityStructure[]) requestDetails.elementAt(2); } public String getSQLStmt(ClassGraph cg) { getRequestDetails(cg); return (String) requestDetails.elementAt(3); } public HierarchyArgs getHierarchyArgs(ClassGraph cg) { getRequestDetails(cg); return (HierarchyArgs) requestDetails.elementAt(4); } private void getRequestDetails(ClassGraph cg) { if (requestDetails == null) { TraversalGraph tg = new TraversalGraph("from Request to *", cg); requestDetails = (Vector) tg.traverse(this, new RequestProcessingVisitor()); } } }} }