List of usage examples for java.lang ClassNotFoundException ClassNotFoundException
public ClassNotFoundException(String s)
ClassNotFoundException
with the specified detail message. From source file:org.geoserver.wps.remote.plugin.XMPPClient.java
/** * Convert a given String into the appropriate Class. * //from w ww . j a v a 2 s .co m * @param name Name of class * @param cl ClassLoader to use * @param object * @param sample * * @return The class for the given name * * @throws ClassNotFoundException When the class could not be found by the specified ClassLoader */ final static ParameterTemplate convertToJavaClass(String name, ClassLoader cl, Object defaultValue) throws ClassNotFoundException { int arraySize = 0; while (name.endsWith("[]")) { name = name.substring(0, name.length() - 2); arraySize++; } // Retrieve the Class of the parameter through the mapping String mimeTypes = ""; Class c = null; if (name.equalsIgnoreCase("complex") || name.equalsIgnoreCase("complex")) { // Is it a complex/raw data type? c = RawData.class; } else if (PRIMITIVE_NAME_TYPE_MAP.get(name) != null) { // Check for a primitive type c = (Class) ((Object[]) PRIMITIVE_NAME_TYPE_MAP.get(name))[0]; } if (c == null) { // No primitive, try to load it from the given ClassLoader try { c = cl.loadClass(name); } catch (ClassNotFoundException cnfe) { throw new ClassNotFoundException("Parameter class not found: " + name); } } // if we have an array get the array class if (arraySize > 0) { int[] dims = new int[arraySize]; for (int i = 0; i < arraySize; i++) { dims[i] = 1; } c = Array.newInstance(c, dims).getClass(); } // Set the default value or the sample object Object sample; if (defaultValue != null && CType.SIMPLE.equals(((Object[]) PRIMITIVE_NAME_TYPE_MAP.get(name))[1])) { sample = defaultValue; } else if (CType.COMPLEX.equals(((Object[]) PRIMITIVE_NAME_TYPE_MAP.get(name))[1]) && ((Object[]) PRIMITIVE_NAME_TYPE_MAP.get(name)).length > 2) { sample = ((Object[]) PRIMITIVE_NAME_TYPE_MAP.get(name))[2]; } else { sample = null; } if (PRIMITIVE_NAME_TYPE_MAP.get(name) != null) mimeTypes = (String) ((Object[]) PRIMITIVE_NAME_TYPE_MAP.get(name))[3]; return new ParameterTemplate(c, sample, mimeTypes); }
From source file:org.allcolor.yahp.converter.CClassLoader.java
protected final Class findClass(final String name) throws ClassNotFoundException { try {//from www .j av a 2s .c o m if (name == null) { return null; } if (name.startsWith("java.") || name.startsWith("sun.reflect")) { return ClassLoader.getSystemClassLoader().loadClass(name); } final String searchClass = name.replace('.', '/') + ".class"; final CThreadContext context = CThreadContext.getInstance(); final String cpName = CClassLoader.CCLASSLOADER_NAMESPACE + name; List lPriorLoader = (List) context.get(cpName); if (lPriorLoader == null) { lPriorLoader = new Vector(); context.set(cpName, lPriorLoader); } if (lPriorLoader.contains(this.toString())) { return null; } lPriorLoader.add(this.toString()); if (CClassLoader.sl(CClassLoader.DEBUG)) { CClassLoader.log("Searching " + name + " in " + this.getPath(), CClassLoader.DEBUG); } final WeakReference cache = (WeakReference) this.cacheMap.get(name); if (cache != null) { final Class c = (Class) cache.get(); if (c != null) { return c; } } // first check if this class as a mandatory loader if (!this.booAlone) { CClassLoader loader = null; for (final Iterator it = CClassLoader.mandatoryLoadersMap.entrySet().iterator(); it.hasNext();) { final Entry entry = (Entry) it.next(); loader = (CClassLoader) entry.getValue(); if (loader.classesMap.containsKey(searchClass)) { if (loader != this) { break; } loader = null; break; } loader = null; } if (loader != null) { final Class c = loader.findClass(name); if (c != null) { return c; } } } // second search in this repository byte buffer[] = null; final URL urlToResource = (URL) this.classesMap.get(searchClass); if (urlToResource != null) { buffer = CClassLoader.loadByteArray(urlToResource); } if (buffer != null) { if (CClassLoader.sl(CClassLoader.DEBUG)) { CClassLoader.log("Loaded " + name + " in " + this.getPath(), CClassLoader.DEBUG); } Class c = null; c = this.findLoadedClass(name); if (c == null) { try { c = this.defineClass(name, buffer, 0, buffer.length); } catch (final LinkageError e) { c = this.findLoadedClass(name); if (c == null) { throw new ClassNotFoundException(name + " was not found !"); } } } if (c != null) { return c; } } // then search in each children final List tmpLoader = new ArrayList(); for (final Iterator it = this.childrenMap.entrySet().iterator(); it.hasNext();) { final Entry entry = (Entry) it.next(); final CClassLoader child = (CClassLoader) entry.getValue(); if (lPriorLoader.contains(child.toString())) { continue; } tmpLoader.add(child); } for (final Iterator it = tmpLoader.iterator(); it.hasNext();) { final Object element = it.next(); final CClassLoader child = (CClassLoader) element; final Class c = child.findClass(name); if (c != null) { return c; } } // then follow to parents if ((this != CClassLoader.getRootLoader()) && !this.booDoNotForwardToParent) { if (lPriorLoader.contains(this.getParent().toString())) { return null; } else { if (this.getParent() instanceof CClassLoader) { return ((CClassLoader) this.getParent()).findClass(name); } else { return this.getParent().loadClass(name); } } } else { try { ClassLoader contextLoader = CClassLoader.getContextLoader(); if (contextLoader == null) { contextLoader = CClassLoader.getRootLoader().getParent(); } final Class c = contextLoader.loadClass(name); if (c != null) { return c; } } catch (Throwable e) { final Class c = CClassLoader.getRootLoader().getParent().loadClass(name); if (c != null) { return c; } } throw new ClassNotFoundException(name); } } catch (ClassNotFoundException e) { throw e; } catch (NoClassDefFoundError e) { throw e; } catch (Throwable e) { throw new ClassNotFoundException(name, e); } }
From source file:org.quartz.impl.jdbcjobstore.StdJDBCDelegate.java
/** * <p>/*from w w w . java 2 s . c o m*/ * Select a trigger. * </p> * * @param conn * the DB Connection * @param triggerName * the name of the trigger * @param groupName * the group containing the trigger * @return the <code>{@link org.quartz.Trigger}</code> object */ public Trigger selectTrigger(Connection conn, String triggerName, String groupName) throws SQLException, ClassNotFoundException, IOException { PreparedStatement ps = null; ResultSet rs = null; try { Trigger trigger = null; ps = conn.prepareStatement(rtp(SELECT_TRIGGER)); ps.setString(1, triggerName); ps.setString(2, groupName); rs = ps.executeQuery(); if (rs.next()) { String jobName = rs.getString(COL_JOB_NAME); String jobGroup = rs.getString(COL_JOB_GROUP); boolean volatility = getBoolean(rs, COL_IS_VOLATILE); String description = rs.getString(COL_DESCRIPTION); long nextFireTime = rs.getLong(COL_NEXT_FIRE_TIME); long prevFireTime = rs.getLong(COL_PREV_FIRE_TIME); String triggerType = rs.getString(COL_TRIGGER_TYPE); long startTime = rs.getLong(COL_START_TIME); long endTime = rs.getLong(COL_END_TIME); String calendarName = rs.getString(COL_CALENDAR_NAME); int misFireInstr = rs.getInt(COL_MISFIRE_INSTRUCTION); int priority = rs.getInt(COL_PRIORITY); Map map = null; if (canUseProperties()) { map = getMapFromProperties(rs); } else { map = (Map) getObjectFromBlob(rs, COL_JOB_DATAMAP); } Date nft = null; if (nextFireTime > 0) { nft = new Date(nextFireTime); } Date pft = null; if (prevFireTime > 0) { pft = new Date(prevFireTime); } Date startTimeD = new Date(startTime); Date endTimeD = null; if (endTime > 0) { endTimeD = new Date(endTime); } rs.close(); ps.close(); if (triggerType.equals(TTYPE_SIMPLE)) { ps = conn.prepareStatement(rtp(SELECT_SIMPLE_TRIGGER)); ps.setString(1, triggerName); ps.setString(2, groupName); rs = ps.executeQuery(); if (rs.next()) { int repeatCount = rs.getInt(COL_REPEAT_COUNT); long repeatInterval = rs.getLong(COL_REPEAT_INTERVAL); int timesTriggered = rs.getInt(COL_TIMES_TRIGGERED); SimpleTrigger st = new SimpleTrigger(triggerName, groupName, jobName, jobGroup, startTimeD, endTimeD, repeatCount, repeatInterval); st.setCalendarName(calendarName); st.setMisfireInstruction(misFireInstr); st.setTimesTriggered(timesTriggered); st.setVolatility(volatility); st.setNextFireTime(nft); st.setPreviousFireTime(pft); st.setDescription(description); st.setPriority(priority); if (null != map) { st.setJobDataMap(new JobDataMap(map)); } trigger = st; } } else if (triggerType.equals(TTYPE_CRON)) { ps = conn.prepareStatement(rtp(SELECT_CRON_TRIGGER)); ps.setString(1, triggerName); ps.setString(2, groupName); rs = ps.executeQuery(); if (rs.next()) { String cronExpr = rs.getString(COL_CRON_EXPRESSION); String timeZoneId = rs.getString(COL_TIME_ZONE_ID); CronTrigger ct = null; try { TimeZone timeZone = null; if (timeZoneId != null) { timeZone = TimeZone.getTimeZone(timeZoneId); } ct = new CronTrigger(triggerName, groupName, jobName, jobGroup, startTimeD, endTimeD, cronExpr, timeZone); } catch (Exception neverHappens) { // expr must be valid, or it never would have // gotten to the store... } if (null != ct) { ct.setCalendarName(calendarName); ct.setMisfireInstruction(misFireInstr); ct.setVolatility(volatility); ct.setNextFireTime(nft); ct.setPreviousFireTime(pft); ct.setDescription(description); ct.setPriority(priority); if (null != map) { ct.setJobDataMap(new JobDataMap(map)); } trigger = ct; } } } else if (triggerType.equals(TTYPE_BLOB)) { ps = conn.prepareStatement(rtp(SELECT_BLOB_TRIGGER)); ps.setString(1, triggerName); ps.setString(2, groupName); rs = ps.executeQuery(); if (rs.next()) { trigger = (Trigger) getObjectFromBlob(rs, COL_BLOB); } } else { throw new ClassNotFoundException("class for trigger type '" + triggerType + "' not found."); } } return trigger; } finally { closeResultSet(rs); closeStatement(ps); } }
From source file:org.apache.hadoop.raid.RaidNode.java
/** * Create an instance of the appropriate subclass of RaidNode *///from w ww.j a va 2 s . c o m public static RaidNode createRaidNode(Configuration conf) throws ClassNotFoundException { try { // default to distributed raid node Class<?> raidNodeClass = conf.getClass(RAIDNODE_CLASSNAME_KEY, DistRaidNode.class); if (!RaidNode.class.isAssignableFrom(raidNodeClass)) { throw new ClassNotFoundException("not an implementation of RaidNode"); } Constructor<?> constructor = raidNodeClass.getConstructor(new Class[] { Configuration.class }); return (RaidNode) constructor.newInstance(conf); } catch (NoSuchMethodException e) { throw new ClassNotFoundException("cannot construct raidnode", e); } catch (InstantiationException e) { throw new ClassNotFoundException("cannot construct raidnode", e); } catch (IllegalAccessException e) { throw new ClassNotFoundException("cannot construct raidnode", e); } catch (InvocationTargetException e) { throw new ClassNotFoundException("cannot construct raidnode", e); } }
From source file:org.apache.axis2.context.MessageContext.java
/** * Restore the contents of the MessageContext that was * previously saved.// w w w . j av a 2 s . c o m * <p/> * NOTE: The field data must read back in the same order and type * as it was written. Some data will need to be validated when * resurrected. * * @param inObject The stream to read the object contents from * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput inObject) throws IOException, ClassNotFoundException { SafeObjectInputStream in = SafeObjectInputStream.install(inObject); // set the flag to indicate that the message context is being // reconstituted and will need to have certain object references // to be reconciled with the current engine setup needsToBeReconciled = true; // trace point if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace( myClassName + ":readExternal(): BEGIN bytes available in stream [" + in.available() + "] "); } //--------------------------------------------------------- // object level identifiers //--------------------------------------------------------- // serialization version ID long suid = in.readLong(); // revision ID int revID = in.readInt(); // make sure the object data is in a version we can handle if (suid != serialVersionUID) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_SUID); } // make sure the object data is in a revision level we can handle if (revID != REVISION_2) { throw new ClassNotFoundException(ExternalizeConstants.UNSUPPORTED_REVID); } //--------------------------------------------------------- // various simple fields //--------------------------------------------------------- // the type of execution flow for the message context FLOW = in.readInt(); // various flags processingFault = in.readBoolean(); paused = in.readBoolean(); outputWritten = in.readBoolean(); newThreadRequired = in.readBoolean(); isSOAP11 = in.readBoolean(); doingREST = in.readBoolean(); doingMTOM = in.readBoolean(); doingSwA = in.readBoolean(); responseWritten = in.readBoolean(); serverSide = in.readBoolean(); long time = in.readLong(); setLastTouchedTime(time); logCorrelationID = (String) in.readObject(); // trace point if (DEBUG_ENABLED && log.isTraceEnabled()) { logCorrelationIDString = "[MessageContext: logID=" + getLogCorrelationID() + "]"; log.trace(myClassName + ":readExternal(): reading the input stream for " + getLogIDString()); } //--------------------------------------------------------- // Message // Read the message and attachments //--------------------------------------------------------- envelope = MessageExternalizeUtils.readExternal(in, this, getLogIDString()); //--------------------------------------------------------- // ArrayList executionChain // handler and phase related data //--------------------------------------------------------- // Restore the metadata about each member of the list // and the order of the list. // This metadata will be used to match up with phases // and handlers on the engine. // // Non-null list: // UTF - description string // boolean - active flag // int - current handler index // int - current phase index // int - expected number of entries in the list // not including the last entry marker // objects - MetaDataEntry object per list entry // last entry will be empty MetaDataEntry // with MetaDataEntry.LAST_ENTRY marker // int - adjusted number of entries in the list // includes the last empty entry // // Empty list: // UTF - description string // boolean - empty flag //--------------------------------------------------------- // the local chain is not enabled until the // list has been reconstituted executionChain = null; currentHandlerIndex = -1; currentPhaseIndex = 0; metaExecutionChain = null; String marker = in.readUTF(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read executionChain, marker is: " + marker); } boolean gotChain = in.readBoolean(); if (gotChain == ExternalizeConstants.ACTIVE_OBJECT) { metaHandlerIndex = in.readInt(); metaPhaseIndex = in.readInt(); int expectedNumberEntries = in.readInt(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): execution chain: expected number of entries [" + expectedNumberEntries + "]"); } // setup the list metaExecutionChain = new ArrayList<MetaDataEntry>(); // process the objects boolean keepGoing = true; int count = 0; while (keepGoing) { // stop when we get to the end-of-list marker // get the object Object tmpObj = in.readObject(); count++; MetaDataEntry mdObj = (MetaDataEntry) tmpObj; // get the class name, then add it to the list String tmpClassNameStr; String tmpQNameAsStr; if (mdObj != null) { tmpClassNameStr = mdObj.getClassName(); if (tmpClassNameStr.equalsIgnoreCase(MetaDataEntry.END_OF_LIST)) { // this is the last entry keepGoing = false; } else { // add the entry to the meta data list metaExecutionChain.add(mdObj); tmpQNameAsStr = mdObj.getQNameAsString(); if (DEBUG_ENABLED && log.isTraceEnabled()) { String tmpHasList = mdObj.isListEmpty() ? "no children" : "has children"; if (log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data class [" + tmpClassNameStr + "] qname [" + tmpQNameAsStr + "] index [" + count + "] [" + tmpHasList + "]"); } } } } else { // some error occurred keepGoing = false; } } // end while keep going int adjustedNumberEntries = in.readInt(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): adjusted number of entries ExecutionChain [" + adjustedNumberEntries + "] "); } } if ((metaExecutionChain == null) || (metaExecutionChain.isEmpty())) { if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data for Execution Chain is NULL"); } } //--------------------------------------------------------- // LinkedList executedPhases // // Note that in previous versions of Axis2, this was // represented by two lists: "inboundExecutedPhases", "outboundExecutedPhases", // however since the message context itself represents a flow // direction, one of these lists was always null. This was changed // around 2007-06-08 revision r545615. For backward compatability // with streams saved in previous versions of Axis2, we need // to be able to process both the old style and new style. //--------------------------------------------------------- // Restore the metadata about each member of the list // and the order of the list. // This metadata will be used to match up with phases // and handlers on the engine. // // Non-null list: // UTF - description string // boolean - active flag // int - expected number of entries in the list // not including the last entry marker // objects - MetaDataEntry object per list entry // last entry will be empty MetaDataEntry // with MetaDataEntry.LAST_ENTRY marker // int - adjusted number of entries in the list // includes the last empty entry // // Empty list: // UTF - description string // boolean - empty flag //--------------------------------------------------------- // the local chain is not enabled until the // list has been reconstituted executedPhases = null; metaExecuted = null; marker = in.readUTF(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read executedPhases, marker is: " + marker); } // Previous versions of Axis2 saved two phases in the stream, although one should // always have been null. The two phases and their associated markers are, in this order: // "inboundExecutedPhases", "outboundExecutedPhases". boolean gotInExecList = in.readBoolean(); boolean oldStyleExecutedPhases = false; if (marker.equals("inboundExecutedPhases")) { oldStyleExecutedPhases = true; } if (oldStyleExecutedPhases && (gotInExecList == ExternalizeConstants.EMPTY_OBJECT)) { // There are an inboundExecutedPhases and an outboundExecutedPhases and this one // is empty, so skip over it and read the next one marker = in.readUTF(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace( getLogIDString() + ": readExternal(): Skipping over oldStyle empty inboundExecutedPhases"); log.trace( getLogIDString() + ": readExternal(): About to read executedPhases, marker is: " + marker); } gotInExecList = in.readBoolean(); } /* * At this point, the stream should point to either "executedPhases" if this is the * new style of serialization. If it is the oldStyle, it should point to whichever * of "inbound" or "outbound" executed phases contains an active object, since only one * should */ if (gotInExecList == ExternalizeConstants.ACTIVE_OBJECT) { int expectedNumberInExecList = in.readInt(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): executed phases: expected number of entries [" + expectedNumberInExecList + "]"); } // setup the list metaExecuted = new LinkedList<MetaDataEntry>(); // process the objects boolean keepGoing = true; int count = 0; while (keepGoing) { // stop when we get to the end-of-list marker // get the object Object tmpObj = in.readObject(); count++; MetaDataEntry mdObj = (MetaDataEntry) tmpObj; // get the class name, then add it to the list String tmpClassNameStr; String tmpQNameAsStr; String tmpHasList = "no list"; if (mdObj != null) { tmpClassNameStr = mdObj.getClassName(); if (tmpClassNameStr.equalsIgnoreCase(MetaDataEntry.END_OF_LIST)) { // this is the last entry keepGoing = false; } else { // add the entry to the meta data list metaExecuted.add(mdObj); tmpQNameAsStr = mdObj.getQNameAsString(); if (!mdObj.isListEmpty()) { tmpHasList = "has list"; } if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data class [" + tmpClassNameStr + "] qname [" + tmpQNameAsStr + "] index [" + count + "] [" + tmpHasList + "]"); } } } else { // some error occurred keepGoing = false; } } // end while keep going int adjustedNumberInExecList = in.readInt(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): adjusted number of entries executedPhases [" + adjustedNumberInExecList + "] "); } } if ((metaExecuted == null) || (metaExecuted.isEmpty())) { if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): meta data for executedPhases list is NULL"); } } marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): After reading executedPhases, marker is: " + marker); } // If this is an oldStyle that contained both an inbound and outbound executed phases, // and the outbound phases wasn't read above, then we need to skip over it if (marker.equals("outboundExecutedPhases")) { Boolean gotOutExecList = in.readBoolean(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): Skipping over outboundExecutedPhases, marker is: " + marker + ", is list an active object: " + gotOutExecList); } if (gotOutExecList != ExternalizeConstants.EMPTY_OBJECT) { throw new IOException("Both inboundExecutedPhases and outboundExecutedPhases had active objects"); } marker = in.readUTF(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): After skipping ooutboundExecutePhases, marker is: " + marker); } } //--------------------------------------------------------- // options //--------------------------------------------------------- options = (Options) in.readObject(); if (options != null) { if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): restored Options [" + options.getLogCorrelationIDString() + "]"); } } //--------------------------------------------------------- // operation //--------------------------------------------------------- // axisOperation is not usable until the meta data has been reconciled axisOperation = null; marker = in.readUTF(); // Read Marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read axisOperation, marker is: " + marker); } metaAxisOperation = (MetaDataEntry) in.readObject(); // operation context is not usable until it has been activated // NOTE: expect this to be the parent marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read operationContext, marker is: " + marker); } operationContext = (OperationContext) in.readObject(); if (operationContext != null) { if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ":readExternal(): restored OperationContext [" + operationContext.getLogCorrelationIDString() + "]"); } } //--------------------------------------------------------- // service //--------------------------------------------------------- // axisService is not usable until the meta data has been reconciled axisService = null; marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read axisService, marker is: " + marker); } metaAxisService = (MetaDataEntry) in.readObject(); //------------------------- // serviceContextID string //------------------------- serviceContextID = (String) in.readObject(); //------------------------- // serviceContext //------------------------- marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read serviceContext, marker is: " + marker); } boolean servCtxActive = in.readBoolean(); if (servCtxActive == ExternalizeConstants.EMPTY_OBJECT) { // empty object serviceContext = null; } else { // active object boolean isParent = in.readBoolean(); // there's an object to read in if it is not the parent of the operation context if (!isParent) { serviceContext = (ServiceContext) in.readObject(); } else { // the service context is the parent of the operation context // so get it from the operation context during activate serviceContext = null; } } //--------------------------------------------------------- // serviceGroup //--------------------------------------------------------- // axisServiceGroup is not usable until the meta data has been reconciled axisServiceGroup = null; marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read AxisServiceGroup, marker is: " + marker); } metaAxisServiceGroup = (MetaDataEntry) in.readObject(); //----------------------------- // serviceGroupContextId string //----------------------------- serviceGroupContextId = (String) in.readObject(); //----------------------------- // serviceGroupContext //----------------------------- marker = in.readUTF(); if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace( getLogIDString() + ": readExternal(): About to read ServiceGroupContext, marker is: " + marker); } boolean servGrpCtxActive = in.readBoolean(); if (servGrpCtxActive == ExternalizeConstants.EMPTY_OBJECT) { // empty object serviceGroupContext = null; } else { // active object boolean isParentSGC = in.readBoolean(); // there's an object to read in if it is not the parent of the service group context if (!isParentSGC) { serviceGroupContext = (ServiceGroupContext) in.readObject(); } else { // the service group context is the parent of the service context // so get it from the service context during activate serviceGroupContext = null; } } //--------------------------------------------------------- // axis message //--------------------------------------------------------- // axisMessage is not usable until the meta data has been reconciled axisMessage = null; marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read AxisMessage, marker is: " + marker); } metaAxisMessage = (MetaDataEntry) in.readObject(); reconcileAxisMessage = (metaAxisMessage != null); //--------------------------------------------------------- // configuration context //--------------------------------------------------------- // TODO: check to see if there is any runtime data important to this // message context in the configuration context // if so, then need to restore the saved runtime data and reconcile // it with the configuration context on the system when // this message context object is restored //--------------------------------------------------------- // session context //--------------------------------------------------------- sessionContext = (SessionContext) in.readObject(); //--------------------------------------------------------- // transport //--------------------------------------------------------- //------------------------------ // incomingTransportName string //------------------------------ incomingTransportName = (String) in.readObject(); // TransportInDescription transportIn // is not usable until the meta data has been reconciled transportIn = null; metaTransportIn = (MetaDataEntry) in.readObject(); // TransportOutDescription transportOut // is not usable until the meta data has been reconciled transportOut = null; metaTransportOut = (MetaDataEntry) in.readObject(); //--------------------------------------------------------- // properties //--------------------------------------------------------- // read local properties marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read properties, marker is: " + marker); } properties = in.readMap(new HashMap()); //--------------------------------------------------------- // special data //--------------------------------------------------------- marker = in.readUTF(); // Read marker if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace(getLogIDString() + ": readExternal(): About to read SpecialData, marker is: " + marker); } boolean gotSelfManagedData = in.readBoolean(); if (gotSelfManagedData == ExternalizeConstants.ACTIVE_OBJECT) { selfManagedDataHandlerCount = in.readInt(); if (selfManagedDataListHolder == null) { selfManagedDataListHolder = new ArrayList<SelfManagedDataHolder>(); } else { selfManagedDataListHolder.clear(); } for (int i = 0; i < selfManagedDataHandlerCount; i++) { selfManagedDataListHolder.add((SelfManagedDataHolder) in.readObject()); } } //--------------------------------------------------------- // done //--------------------------------------------------------- // trace point if (DEBUG_ENABLED && log.isTraceEnabled()) { log.trace( getLogIDString() + ":readExternal(): message context object created for " + getLogIDString()); } }
From source file:self.philbrown.droidQuery.$.java
/** * Add an extension with the reference <em>name</em> * @param name String used by the {@link #ext(String)} method for calling this extension * @param clazz the name of the subclass of {@link $Extension} that will be mapped to {@code name}. * Calling {@code $.with(this).ext(myExtension); } will now create a new instance of the given * {@code clazz}, passing in {@code this} instance of <em>$</em>, then calling the {@code invoke} * method.//from www . j a v a2 s . co m * @throws ClassNotFoundException if {@code clazz} is not a valid class name, or if it is not a * subclass of {@code $Extension}. * @throws NoSuchMethodException * @throws SecurityException * @throws IllegalAccessException * @throws InstantiationException * @note be aware that there is no check for if this extension overwrites a different extension. */ public static void extend(String name, String clazz) throws ClassNotFoundException, SecurityException, NoSuchMethodException, InstantiationException, IllegalAccessException { Class<?> _class = Class.forName(clazz); Class<?> _super = _class.getSuperclass(); if (_super == null || _super != $Extension.class) { throw new ClassNotFoundException("clazz must be subclass of $Extension!"); } Constructor<?> constructor = _class.getConstructor(new Class<?>[] { $.class }); extensions.put(name, constructor); }
From source file:self.philbrown.droidQuery.$.java
/** * Add an extension with the reference <em>name</em> * @param name String used by the {@link #ext(String)} method for calling this extension * @param clazz subclass of {@link $Extension} that will be mapped to {@code name}. * Calling {@code $.with(this).ext(MyExtension.class); } will now create a new instance of the given * {@code clazz}, passing in {@code this} instance of <em>$</em>, then calling the {@code invoke} * method.// w ww . j a va 2s .com * @throws ClassNotFoundException if {@code clazz} is not a valid class name, or if it is not a * subclass of {@code $Extension}. * @throws NoSuchMethodException * @throws SecurityException * @throws IllegalAccessException * @throws InstantiationException * @note be aware that there is no check for if this extension overwrites a different extension. */ public static void extend(String name, Class<?> clazz) throws ClassNotFoundException, SecurityException, NoSuchMethodException { Class<?> _super = clazz.getSuperclass(); if (_super == null || _super != $Extension.class) { throw new ClassNotFoundException("clazz must be subclass of $Extension!"); } Constructor<?> constructor = clazz.getConstructor(new Class<?>[] { $.class }); extensions.put(name, constructor); }