protected String azimuthReference; // aziRef /** * Create a trajectory object with specified ID and parent. * * @param id ID of this trajectory. * @param wellbore Parent wellbore of this trajectory. */ protected WitsmlTrajectory(WitsmlServer server, String id, String name, WitsmlObject parent, String parentId) : base(server, WITSML_TYPE, id, name, parent, parentId) { }
protected Object _extensionNameValue; //cs_extensionNameValue protected WitsmlWellboreGeometrySection(WitsmlServer server, String id, String name, WitsmlObject parent, String parentId) : base(server, WITSML_TYPE, id, name, parent, parentId) { }
protected CommonData commonData; //Common data of this instance. May be null /// <summary> /// Create a new WITSML object with specified properties. /// </summary> /// <param name="server">Server backing this instance. Non-null.</param> /// <param name="type">WITSML type of this instance. Non-null.</param> /// <param name="id">ID of this instance. Null if ID is not supported for this type.</param> /// <param name="name">Name of this instance. May be null if not loaded or not suppoerted for this type.</param> /// <param name="parent"></param> /// <param name="parentId"></param> protected WitsmlObject(WitsmlServer server, String type, String id, String name, WitsmlObject parent, String parentId) { if (server == null) { throw new ArgumentNullException("server cannot be null"); } if (type == null) { throw new ArgumentNullException("type cannot be null"); } this.server = server; this.type = type; this.id = id; this.name = name; this.parent = parent; this.parentId = parent != null?parent.getId() : parentId; }
/** * Create a WITSML response information instance. * * @param requestTime Time of request in milliseconds since the epoch. * @param requestXml The request XML. Non-null. * @param responseXml The response XML. May be null. * @param throwable Throwable if one was thrown, or null if not. */ internal WitsmlAccessEvent(WitsmlServer witsmlServer, String wsdlFunction, String witsmlType, long requestTime, String request, String response, Int32?statusCode, String serverMessage, Exception throwable) //Throwable throwable) { //Debug.Assert(witsmlServer != null : "witsmlServer cannot be null"; //Debug.Assert(wsdlFunction != null : "wsdlFunction cannot be null"; //Debug.Assert(requestTime <= System.currentTimeMillis() : "Request time in the future: " + requestTime; this.witsmlServer = witsmlServer; this.wsdlFunction = wsdlFunction; this.witsmlType = witsmlType; this.requestTime = requestTime; this.request = request; this.response = response; this.statusCode = statusCode; this.serverMessage = serverMessage; this.responseTime = DateTime.Now.Ticks - requestTime; // System.currentTimeMillis() - requestTime; this.throwable = throwable; }
/** * Create a well object with specified ID. * * @param id ID of this well. */ protected WitsmlWell(WitsmlServer server, String id, String name, WitsmlObject parent) : base(server, WITSML_TYPE, id, name, parent, null) { }
protected Int32?reportNumber; //numReport protected WitsmlFluidsReport(WitsmlServer server, String id, String name, WitsmlObject parent, String parentId) : base(server, WITSML_TYPE, id, name, parent, parentId) { }
/// <summary> /// Create a realtime object with specified parent. /// </summary> /// <param name="server"></param> /// <param name="id"></param> /// <param name="parent"></param> /// <param name="parentId"></param> protected WitsmlRealtime(WitsmlServer server, String id, WitsmlObject parent, String parentId) : base(server, WITSML_TYPE, id, null, parent, parentId) { }
/// <summary> /// Return instances from this WITSML server. /// </summary> /// <typeparam name="T">Type of the Class to return. Non-null.</typeparam> /// <param name="witsmlQuery">Query to apply. Non-null.</param> /// <param name="id">ID of instance to get, or null to indicate all.</param> /// <param name="parent">arent object. Null to indicate root-level or if parent IDs are specified instead.</param> /// <param name="parentIds"> ID of parent(s). Closest parent first. Null to indicate root-level or if parent instance is specified instead.</param> /// <returns>List of Requested instances. Never null.</returns> private List <T> get <T>(WitsmlQuery witsmlQuery, String id, WitsmlObject parent, params String[] parentIds) where T : WitsmlObject { if (witsmlQuery == null) { throw new ArgumentException("witsmlQuery cannot be null"); } if (parent != null && parentIds != null && parentIds.Length > 0) { throw new ArgumentException("Both parent and parentIds can't be set"); } String wsdlFunction = "WMLS_GetFromStore"; // Prepare the return structure List <T> instances = new List <T>(); String actualId = id != null ? id : ""; String[] parentId; if (parent != null) { parentId = getIds(parent); } else if (parentIds != null) { parentId = parentIds; } else { parentId = new String[] { "" } }; long requestTime = DateTime.Now.Ticks; String queryXml = ""; String responseXml = null; String type = WitsmlServer.getWitsmlType(typeof(T)); var actualClass = getActualClass(version, type); try { var getQueryMethod = actualClass.GetMethod("getQuery", BindingFlags.NonPublic | BindingFlags.Static); queryXml = (string)getQueryMethod.Invoke(null, new object[] { actualId, parentId }); //// Find the getQuery() method //Method getQueryMethod = actualClass.getDeclaredMethod("getQuery", // String.class, // String[].class); //getQueryMethod.setAccessible(true); //// This is the complete query for the class //queryXml = (String) getQueryMethod.invoke(null, actualId, parentId); //// Apply nodifications as specified by the WitsmlQuery instance queryXml = witsmlQuery.apply(queryXml); // Send the query to the WITSML server and pick the response WitsmlResponse response = accessor.get(type, queryXml); responseXml = response.getResponse(); notify(wsdlFunction, type, requestTime, queryXml, responseXml, response.getStatusCode(), response.getServerMessage(), null); // If nothing was returned we leave here if (responseXml == null || responseXml.Length == 0) { return(instances); } // // Build DOM document // //SAXBuilder builder = new SAXBuilder(); XDocument document = XDocument.Load(new StringReader(responseXml)); //Document document = XDocument.Load(new StringReader(responseXml)); XElement rootElement = document.Root; //Element rootElement = document.getRootElement(); // // Find the newInstance() method // MethodInfo newInstanceMethod = actualClass.GetMethod("newInstance", BindingFlags.NonPublic | BindingFlags.Static); //.getDeclaredMethod("newInstance", #if DEBUG if (newInstanceMethod == null) { throw new NotImplementedException("newInstance method is not implemented for the classe " + actualClass.Name); } #endif //WitsmlServer.class, // WitsmlObject.class, // Element.class); //newInstanceMethod.setAccessible(true); // // Loop over the elements and create instances accordingly // var elements = rootElement.Elements(rootElement.Name.Namespace + type); //.getChildren(type, rootElement.getNamespace()); foreach (Object element in elements) { WitsmlObject instance = (WitsmlObject)newInstanceMethod.Invoke(null, new object[] { this, parent, element }); //.invoke(null, this, parent, element); instances.Add(instance as T); // baseClass.cast(instance)); } return(instances); } catch (MissingMemberException exception) {// NoSuchMethodException exception) { // Programmer error //Debug.Assert(false : "Method not found: " + actualClass; return(null); } catch (AccessViolationException exception) {// IllegalAccessException exception) { // Programmer error //Debug.Assert(false : "Unable to invoke: " + actualClass; return(null); } catch (TargetInvocationException exception) {// InvocationTargetException exception) { // Wrapped exception from the invocation such as WitsmlParseException //TODO re-implement this notify(wsdlFunction, type, requestTime, queryXml, responseXml, null, null, exception.InnerException); //.getCause()); String message = "Exception thrown by " + actualClass + ".newInstance()"; throw new WitsmlServerException(message, exception.InnerException); //.getCause()); } //catch ( RemoteException exception) { // // Connection problems. // //TODO // //notify(wsdlFunction, type, requestTime, queryXml, responseXml, null, null, // // exception); // String message = "Unable to connect to WITSML server: " + this; // throw new WitsmlServerException(message, exception); //} catch (IOException exception) { // Unable to read response XML //TODO //notify(wsdlFunction, type, requestTime, queryXml, responseXml, null, null, // exception); String message = "Unable to read response XML: " + responseXml; throw new WitsmlServerException(message, exception); } //catch ( JDOMException exception) { // // Unable to parse response XML // notify(wsdlFunction, type, requestTime, queryXml, responseXml, null, null, // exception); // String message = "Unable to parse response XML: " + responseXml; // throw new WitsmlServerException(message, exception); //} }
protected String description; // description protected WitsmlFormationMarker(WitsmlServer server, String id, String name, WitsmlObject parent, String parentId) : base(server, WITSML_TYPE, id, name, parent, parentId) { }