Commit 9b044d19 by Tom Tromey

Initial revision

From-SVN: r104578
parent acff2da9
<?xml version='1.0'?>
<?eclipse-cdt version="2.0"?>
<cdtproject/>
\ No newline at end of file
<?xml version='1.0'?>
<launchConfiguration type='org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'><stringAttribute key='org.eclipse.debug.core.ATTR_REFRESH_SCOPE' value='${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;launchConfigurationWorkingSet factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; name=&quot;working set&quot; editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot;&gt;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/classpath/native&quot; type=&quot;2&quot;/&gt;&#10;&lt;/launchConfigurationWorkingSet&gt;}'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS' value='full,incremental,'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE' value='${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;launchConfigurationWorkingSet factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; name=&quot;workingSet&quot; editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot;&gt;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/classpath/native&quot; type=&quot;2&quot;/&gt;&#10;&lt;/launchConfigurationWorkingSet&gt;}'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_LOCATION' value='${system_path:make}'/><booleanAttribute key='org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED' value='true'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY' value='${build_project}'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS' value='-C ${build_project}/native all install'/><booleanAttribute key='org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND' value='false'/><booleanAttribute key='org.eclipse.debug.core.appendEnvironmentVariables' value='true'/></launchConfiguration>
\ No newline at end of file
<?xml version='1.0'?>
<launchConfiguration type='org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'><stringAttribute key='org.eclipse.debug.core.ATTR_REFRESH_SCOPE' value='${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;launchConfigurationWorkingSet factoryID=&quot;org.eclipse.ui.internal.WorkingSetFactory&quot; name=&quot;working set&quot; editPageId=&quot;org.eclipse.ui.resourceWorkingSetPage&quot;&gt;&#10;&lt;item factoryID=&quot;org.eclipse.ui.internal.model.ResourceFactory&quot; path=&quot;/classpath/java/util&quot; type=&quot;2&quot;/&gt;&#10;&lt;/launchConfigurationWorkingSet&gt;}'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS' value='full,incremental,'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_LOCATION' value='${system_path:make}'/><booleanAttribute key='org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED' value='true'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY' value='${build_project}'/><stringAttribute key='org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS' value='-C ${build_project}/lib ../java/util/LocaleData.java'/><booleanAttribute key='org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND' value='false'/><booleanAttribute key='org.eclipse.debug.core.appendEnvironmentVariables' value='true'/></launchConfiguration>
\ No newline at end of file
#include "include/layout.wml"
<subject "GNU Classpath Bug Reports">
<box>
<boxtitle>GNU Classpath::Bugs</boxtitle>
<boxitem>
Unfortunately GNU Classpath is not bug free yet.
<br>
But you can help!
<br>
If you find a bug please report it here.
</boxitem>
<boxtitle>Query</boxtitle>
<boxitem>
Please first check the following lists:
<ul>
<li><a href="http://gcc.gnu.org/bugzilla/query.cgi?product=classpath">Query bugs</a></li>
<li><a href="http://gcc.gnu.org/bugzilla/buglist.cgi?product=classpath&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=SUSPENDED&bug_status=WAITING&bug_status=REOPENED">All open bugs</a></li>
<li><a href="http://gcc.gnu.org/bugzilla/duplicates.cgi?sortby=count&product=classpath">Most Frequently Reported Bugs</a></li>
</ul>
<p>
</boxitem>
<boxtitle>Report</boxtitle>
<boxitem>
If your bug wasn't in any of the above lists, please
<ul>
<li><a href="http://gcc.gnu.org/bugzilla/enter_bug.cgi?product=classpath">Report it</a></li>
<ul>
<p>
</boxitem>
<boxtitle>Overview</boxtitle>
<boxitem>
You can also look at some pretty
<ul>
<li><a href="http://gcc.gnu.org/bugzilla/reports.cgi?product=classpath&datasets=NEW%3A&datasets=ASSIGNED%3A&datasets=REOPENED%3A&datasets=UNCONFIRMED%3A&datasets=RESOLVED%3A&datasets=VERIFIED%3A&datasets=CLOSED%3A&datasets=FIXED%3A&datasets=INVALID%3A&datasets=WONTFIX%3A&datasets=DUPLICATE%3A&datasets=WORKSFORME%3A">Status Counts</a></li>
<li><a href="http://gcc.gnu.org/bugzilla/report.cgi?bug_file_loc_type=allwordssubstr&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=SUSPENDED&bug_status=WAITING&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&cumulate=1&gccbuild_type=allwordssubstr&gcchost_type=allwordssubstr&gcctarget_type=allwordssubstr&keywords_type=allwords&known_to_fail_type=allwordssubstr&known_to_work_type=allwordssubstr&long_desc_type=substring&product=classpath&short_desc_type=allwordssubstr&x_axis_field=component&y_axis_field=bug_status&width=600&height=350&action=wrap&format=table">Component/Status Tables</a></li>
</ul>
<p>
</boxitem>
</box>
# @configure_input@
prefix = @prefix@
exec_prefix = @exec_prefix@
includedir = @includedir@
libdir = @libdir@
pkglibdir = $(libdir)/@PACKAGE@
all: gnu/classpath/examples/jawt/DemoJAWT.class libDemoJAWT.so
@echo "RUN with:"
@echo " LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:.:$(pkglibdir) jamvm \\"
@echo " gnu.classpath.examples.jawt.DemoJAWT"
gnu/classpath/examples/jawt/DemoJAWT.class: gnu/classpath/examples/jawt/DemoJAWT.java
gcj -C gnu/classpath/examples/jawt/DemoJAWT.java
DemoJAWT.h: gnu/classpath/examples/jawt/DemoJAWT.class
gcjh -jni gnu.classpath.examples.jawt.DemoJAWT -o DemoJAWT.h
libDemoJAWT.so: gnu/classpath/examples/jawt/DemoJAWT.c DemoJAWT.h
gcc -g -O0 -Wall -I. -I/usr/X11R6/include -L. -L/usr/X11R6/lib \
-I$(includedir) -L$(pkglibdir) \
-lX11 -ljawtgnu -shared -o libDemoJAWT.so \
gnu/classpath/examples/jawt/DemoJAWT.c
clean:
rm -f DemoJAWT.h
rm -f gnu/classpath/examples/jawt/DemoJAWT*.class
rm -f libDemoJAWT.so
/* DemoJAWT.c -- native portion of AWT Native Interface demo
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
#include "DemoJAWT.h"
#include "jawt_md.h"
#include <string.h>
JNIEXPORT void JNICALL
Java_gnu_classpath_examples_jawt_DemoJAWT_paintIt (JNIEnv* env,
jobject canvas,
jobject graphics,
jboolean on)
{
JAWT awt;
JAWT_DrawingSurface* surface;
JAWT_DrawingSurfaceInfo* surface_info;
JAWT_X11DrawingSurfaceInfo* surface_info_x11;
jint lock;
GC gc;
int c;
char* test_string = "JAWT";
XColor orange;
XColor yellow;
XColor blue;
Display* display;
Drawable drawable;
Status status;
awt.version = JAWT_VERSION_1_3;
if (JAWT_GetAWT (env, &awt) == JNI_FALSE)
{
printf ("couldn't find AWT\n");
return;
}
surface = awt.GetDrawingSurface (env, canvas);
if (surface == NULL)
{
printf ("drawing surface is NULL\n");
return;
}
lock = surface->Lock (surface);
if ((lock & JAWT_LOCK_ERROR) != 0)
{
printf ("couldn't lock drawing surface\n");
awt.FreeDrawingSurface (surface);
return;
}
surface_info = surface->GetDrawingSurfaceInfo (surface);
if (surface_info == NULL)
{
printf ("couldn't get surface information\n");
surface->Unlock (surface);
awt.FreeDrawingSurface (surface);
return;
}
surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface_info->platformInfo;
display = surface_info_x11->display;
drawable = surface_info_x11->drawable;
gc = XCreateGC (display, drawable, 0, 0);
XSetBackground (display, gc, 0);
orange.red = 254 * 65535 / 255;
orange.green = 90 * 65535 / 255;
orange.blue = 16 * 65535 / 255;
/* assume color lookups succeed */
status = XAllocColor (display, DefaultColormap (display,
DefaultScreen (display)),
&orange);
if (!status)
{
printf ("color allocation failed\n");
goto cleanup;
}
yellow.red = 255 * 65535 / 255;
yellow.green = 255 * 65535 / 255;
yellow.blue = 0 * 65535 / 255;
XAllocColor (display, DefaultColormap (display,
DefaultScreen (display)),
&yellow);
if (!status)
{
printf ("color allocation failed\n");
goto cleanup;
}
blue.red = 16 * 65535 / 255;
blue.green = 30 * 65535 / 255;
blue.blue = 137 * 65535 / 255;
XAllocColor (display, DefaultColormap (display,
DefaultScreen (display)),
&blue);
if (!status)
{
printf ("color allocation failed\n");
goto cleanup;
}
for (c = 5; c >= 0; c--)
{
if (c % 2 == on)
XSetForeground (display, gc, yellow.pixel);
else
XSetForeground (display, gc, orange.pixel);
XFillArc (display, drawable, gc, 140 - c * 15, 140 - c * 15, c * 30, c * 30, 0, 360 * 64);
}
XSetForeground (display, gc, blue.pixel);
XDrawString (display, drawable,
gc, 129, 145, test_string, strlen (test_string));
cleanup:
XFreeGC (display, gc);
surface->FreeDrawingSurfaceInfo (surface_info);
surface->Unlock (surface);
awt.FreeDrawingSurface (surface);
}
/* DemoJAWT.java -- AWT Native Interface demo
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
package gnu.classpath.examples.jawt;
import java.awt.*;
import java.awt.event.*;
public class DemoJAWT extends Canvas
{
static
{
System.loadLibrary ("DemoJAWT");
}
public native void paintIt (Graphics g, boolean on);
public void paint (Graphics g)
{
paintIt (g, on);
}
private boolean on;
public static void main (String[] args)
{
Frame f = new Frame ("GNU Classpath JAWT Demo");
f.setBounds (0, 0, 300, 300);
f.setResizable (false);
DemoJAWT jawtDemo = new DemoJAWT ();
f.add (jawtDemo);
f.addWindowListener (new WindowAdapter ()
{
public void windowClosing (WindowEvent evt)
{
System.exit (0);
}
});
f.show ();
while (true)
{
try
{
Thread.sleep (500);
}
catch (InterruptedException ie)
{
// ignored
}
jawtDemo.on = ! jawtDemo.on;
f.repaint();
}
}
}
/* noHeaderInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.CDR;
import org.omg.CORBA.CustomMarshal;
import org.omg.CORBA.DataInputStream;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.Streamable;
import org.omg.CORBA.portable.ValueFactory;
import java.io.Serializable;
/**
* Substitutes the main stream in factories when the header is already
* behind. Overrides methods that may be invoked from the factory,
* forcing not to read the header if called first time on this stream.
*
* This stream reverts to default behavior if one or more call are
* made (reading value types that are nested fields of the value type).
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
class noHeaderInput
extends cdrBufInput
implements DataInputStream
{
/**
* If true, this is not the first call.
*/
boolean notFirst;
/**
* Create an instance, reading from the given buffer.
*/
public noHeaderInput(byte[] buffer)
{
super(buffer);
}
/**
* Read when knowning the class instance.
*/
public Serializable read_value(Class clz)
{
if (notFirst)
return super.read_value(clz);
else
{
try
{
notFirst = true;
return read_value((Serializable) clz.newInstance());
}
catch (Exception ex)
{
MARSHAL m = new MARSHAL("Unable to create an instance");
m.initCause(ex);
throw m;
}
}
}
/**
* Tries to read using boxed value helper.
*/
public Serializable read_value(BoxedValueHelper helper)
{
if (notFirst)
return super.read_value(helper);
else
{
notFirst = true;
return helper.read_value(this);
}
}
/**
* Tries to locate a factory using repository id.
*/
public Serializable read_value(String repository_id)
{
if (notFirst)
return super.read_value(repository_id);
else
{
notFirst = true;
ValueFactory factory =
((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
if (factory == null)
throw new MARSHAL("No factory");
return factory.read_value(this);
}
}
/**
* Try to read when having an unitialised value.
*/
public Serializable read_value(Serializable value)
{
if (notFirst)
return super.read_value(value);
else
{
notFirst = true;
// The user-defines io operations are implemented.
if (value instanceof CustomMarshal)
{
CustomMarshal marsh = (CustomMarshal) value;
try
{
marsh.unmarshal((DataInputStream) this);
}
catch (ClassCastException ex)
{
Vio.incorrect_plug_in(ex);
}
}
else
// The IDL-generated io operations are implemented.
if (value instanceof Streamable)
{
((Streamable) value)._read(this);
}
return value;
}
}
}
\ No newline at end of file
/* abstractDynAny.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.typeNamer;
import org.omg.CORBA.Any;
import org.omg.CORBA.LocalObject;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
import java.io.Serializable;
/**
* The top of our DynAny implementation, this class provides ORB that is
* required to create anys and factory that is required to initialise DynAnys.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public abstract class abstractDynAny
extends LocalObject
implements Serializable
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* The "initial final_type" that can be an alias of the known final_type.
*/
public TypeCode official_type;
/**
* The "basic" final_type to that the final_type finally evaluates.
*/
public final TypeCode final_type;
/**
* The DynAny factory, required in initializations.
*/
public final gnuDynAnyFactory factory;
/**
* The ORB, to that this DynAny belongs.
*/
public final ORB orb;
/**
* The minor code, indicating the error, related to work with non - GNU
* Classpath DynAny.
*/
short MINOR = 8148;
/**
* The message about the empty structure or exception.
*/
static final String EMPTY = "Empty structure with no fields.";
/**
* The message about the structure or exception size mismatch.
*/
static final String SIZE = "Size mismatch.";
/**
* The message about the content of this DynAny being equal to
* <code>null</code>
*/
static final String ISNULL = "The content is null";
/**
* The change value listener.
*/
valueChangedListener listener;
/**
* Create the abstract dyn any.
*/
public abstractDynAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
official_type = oType;
final_type = aType;
factory = aFactory;
orb = anOrb;
}
/**
* Get the typecode.
*/
public TypeCode type()
{
return official_type;
}
/**
* Create the Any.
*/
public Any createAny()
{
return orb.create_any();
}
/**
* The "value changed" listener.
*/
protected void valueChanged()
{
if (listener != null)
listener.changed();
}
/**
* Check the type.
*/
void checkType(TypeCode expected, TypeCode actual)
throws TypeMismatch
{
if (!expected.equal(actual))
throw new TypeMismatch(typeMismatch(expected, actual));
}
/**
* Format "Type mismatch" string.
*/
String typeMismatch(TypeCode expected, TypeCode actual)
{
return typeNamer.nameIt(expected) + " expected " +
typeNamer.nameIt(actual);
}
/**
* Format "size mismatch" string.
*/
String sizeMismatch(int here, int other)
{
return "Size mismatch, " + other + " (expected " + here + ")";
}
}
\ No newline at end of file
/* Undivideable.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.DynAn;
import java.io.Serializable;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
import org.omg.CORBA.TypeCode;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
/**
* Represent DynAny that has no internal components (DynEnum and so on). The
* methods, related to internal components, throw exceptions or return agreed
* values like null.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public abstract class anyUndivideable
extends abstractDynAny
implements Serializable
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* Create a new instance with the given typecode.
*/
public anyUndivideable(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb)
{
super(oType, aType, aFactory, anOrb);
}
/**
* There are no components.
*
* @return 0, always.
*/
public int component_count()
{
return 0;
}
/**
* There is no current component.
*
* @throws TypeMismatch, always.
*/
public DynAny current_component()
throws TypeMismatch
{
throw new TypeMismatch("Not applicable");
}
/**
* Returns without action.
*/
public void destroy()
{
}
/**
* Not in use.
*/
public Any get_any()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public boolean get_boolean()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public char get_char()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public double get_double()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public DynAny get_dyn_any()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public float get_float()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public int get_long()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public long get_longlong()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public byte get_octet()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public Object get_reference()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public short get_short()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public String get_string()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public TypeCode get_typecode()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public int get_ulong()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public long get_ulonglong()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public short get_ushort()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public Serializable get_val()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public char get_wchar()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public String get_wstring()
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_any(Any an_any)
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_boolean(boolean a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_char(char a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_double(double a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_dyn_any(DynAny insert_it)
throws TypeMismatch, InvalidValue
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_float(float a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_long(int a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_longlong(long a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_octet(byte a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_reference(Object a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_short(short a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_string(String a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_typecode(TypeCode a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_ulong(int a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_ulonglong(long a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_ushort(short a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_val(Serializable a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_wchar(char a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public void insert_wstring(String a_x)
throws InvalidValue, TypeMismatch
{
throw new TypeMismatch();
}
/**
* Not in use.
*/
public boolean next()
{
return false;
}
/**
* Not in use.
*/
public void rewind()
{
}
/**
* Not in use.
*/
public boolean seek(int p)
{
return false;
}
/**
* Get the typecode of this enumeration.
*/
public TypeCode type()
{
return official_type;
}
/**
* Compares with other DynAny for equality.
*/
public boolean equals(java.lang.Object other)
{
if (other instanceof DynAny)
return equal((DynAny) other);
else
return false;
}
/**
* This depends on an object.
*/
public abstract boolean equal(DynAny other);
}
/* gnuDynEnum.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
import org.omg.DynamicAny.DynEnum;
import java.io.IOException;
import java.util.Arrays;
/**
* Our implementation of dynamic enumeration.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynEnum extends anyUndivideable implements DynEnum
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* The valid string values of the enumeration. Most of enumerations are short,
* counting 2-5 memebers. With so small number of memebers, it seems not
* reasonable to use hashtables.
*/
final String[] values;
/**
* The current value of enum.
*/
int current;
/**
* Create a new dyn enum from the given typecode.
*/
public gnuDynEnum(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
ORB anOrb
)
{
super(oType, aType, aFactory, anOrb);
try
{
values = new String[ final_type.member_count() ];
for (int i = 0; i < values.length; i++)
{
values [ i ] = final_type.member_name(i);
}
}
catch (Exception e)
{
throw new BAD_PARAM("Not enum");
}
}
/**
* Create a clone of the given enum, sharing values and final_type.
*/
public gnuDynEnum(gnuDynEnum from)
{
super(from.official_type, from.final_type, from.factory, from.orb);
values = from.values;
}
/**
* Assign the Enum from the passed value. The passed DynAny must hold the
* enumeration of exactly the same final_type.
*/
public void assign(DynAny from) throws TypeMismatch
{
checkType(official_type, from.type());
if (!(from instanceof DynEnum))
throw new TypeMismatch("Not a DynEnum");
try
{
set_as_ulong(((DynEnum) from).get_as_ulong());
}
catch (InvalidValue e)
{
TypeMismatch t = new TypeMismatch();
t.initCause(e);
throw t;
}
}
/**
* Copy this DynEnum.
*/
public DynAny copy()
{
gnuDynEnum other = new gnuDynEnum(this);
other.current = current;
return other;
}
/**
* Compares for equality.
*/
public boolean equal(DynAny other)
{
if (other instanceof gnuDynEnum)
{
gnuDynEnum oe = (gnuDynEnum) other;
return current == oe.current &&
(oe.values == values || Arrays.equals(values, oe.values));
}
else if (other instanceof DynEnum)
{
DynEnum oe = (DynEnum) other;
return current == oe.get_as_ulong() && official_type.equal(oe.type());
}
else
return false;
}
/**
* Set value from any that must contain enumeration.
*/
public void from_any(Any an_any) throws TypeMismatch, InvalidValue
{
checkType(official_type, an_any.type());
try
{
InputStream in = an_any.create_input_stream();
set_as_ulong(in.read_long());
in.close();
}
catch (MARSHAL eof)
{
throw new InvalidValue();
}
catch (IOException ex)
{
throw new Unexpected(ex);
}
}
/**
* Get the value of this enumeration as string.
*/
public String get_as_string()
{
return values [ current ];
}
/**
* Get the value of this enumeration as int.
*/
public int get_as_ulong()
{
return current;
}
/**
* Set the value of this enumeration as string.
*/
public void set_as_string(String value) throws InvalidValue
{
for (int i = 0; i < values.length; i++)
{
if (values [ i ].equals(value))
{
current = i;
valueChanged();
return;
}
}
throw new InvalidValue(value);
}
/**
* Set the value of this enumeration as int.
*/
public void set_as_ulong(int value) throws InvalidValue
{
if (value < 0 || value >= values.length)
throw new InvalidValue(value + " not in [0.." + values.length);
else
{
current = value;
valueChanged();
}
}
/**
* Wrap the enumeration value into any.
*/
public Any to_any()
{
Any a = createAny();
a.insert_long(current);
a.type(official_type);
return a;
}
}
\ No newline at end of file
/* gnuDynFixed.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.DynAn;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
import org.omg.DynamicAny.DynFixed;
import org.omg.DynamicAny.DynFixedOperations;
import java.math.BigDecimal;
/**
* Implements DynAny, holding CORBA <code>fixed</code>. This class is derived
* from gnuDynEnm to avoid repetetive inclusion of unused DynAny methods.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynFixed extends anyUndivideable implements DynFixed
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* The default value, assigned in the new instance.
*/
static final BigDecimal ZERO = new BigDecimal("0.0");
/**
* The content of the dyn fixed, wrapped in this DynAny.
*/
BigDecimal value;
/**
* The number of digits after the decimal point.
*/
final int scale;
/**
* The number of digits.
*/
final int digits;
/**
* Create a new instance of the dyn fixed.
*/
public gnuDynFixed(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
super(oType, aType, aFactory, anOrb);
try
{
digits = final_type.fixed_digits();
scale = final_type.fixed_scale();
}
catch (Exception e)
{
throw new BAD_PARAM("Not a fixed");
}
value = ZERO;
}
/**
* Clone the current instance.
*/
public gnuDynFixed(gnuDynFixed from)
{
super(from.official_type, from.final_type, from.factory, from.orb);
digits = from.digits;
scale = from.scale;
value = from.value;
}
/**
* Get the value of the wrapped dyn fixed, as string.
*/
public String get_value()
{
return value.toString();
}
/**
* Set the value.
*/
public boolean set_value(String fixed_value)
throws TypeMismatch, InvalidValue
{
// Count the digits till decimal point.
int digs = 0;
char c;
boolean leading0 = true;
Digs:
for (int i = 0; i < fixed_value.length(); i++)
{
c = fixed_value.charAt(i);
if (Character.isDigit(c))
{
if (!(c == '0' && leading0))
digs++;
if (c != '0')
leading0 = false;
}
else if (c == '.')
break Digs;
}
if (digs > (digits - scale))
throw new InvalidValue("Too many digits: " + digs + " for " + digits +
"." + scale
);
try
{
value = new BigDecimal(fixed_value);
}
catch (NumberFormatException ex)
{
if (fixed_value.trim().length() == 0)
throw new InvalidValue("Empty string passed");
TypeMismatch inva =
new TypeMismatch("Not a number: '" + fixed_value + "'");
inva.initCause(ex);
throw inva;
}
valueChanged();
return value.scale() <= scale;
}
/**
* Assign the value from another BigDecimal.
*/
public void assign(DynAny from) throws TypeMismatch
{
checkType(official_type, from.type());
if (from instanceof gnuDynFixed)
{
gnuDynFixed other = (gnuDynFixed) from;
value = other.value;
}
else if (from instanceof DynFixedOperations)
{
value = new BigDecimal(((DynFixedOperations) from).get_value());
}
else
throw new TypeMismatch("Not a DynFixed");
valueChanged();
}
/**
* Create a copy.
*/
public DynAny copy()
{
return new gnuDynFixed(this);
}
/**
* Compare for equality.
*/
public boolean equal(DynAny other)
{
if (other instanceof gnuDynFixed)
{
// Normally, this code would be executed.
return value.equals(((gnuDynFixed) other).value);
}
if (other instanceof DynFixedOperations)
{
// This may be involved when mixing implementations.
return ((DynFixedOperations) other).get_value().equals(get_value());
}
else
return false;
}
/**
* Set the value from Any (must hold <code>fixed</code> with the matching
* typecode.).
*/
public void from_any(Any an_any) throws TypeMismatch, InvalidValue
{
try
{
checkType(official_type, an_any.type());
value = an_any.extract_fixed();
valueChanged();
}
catch (BAD_OPERATION e)
{
InvalidValue t = new InvalidValue();
t.initCause(e);
throw t;
}
}
/**
* Create and return Any, holding this DynFixed value.
*/
public Any to_any()
{
Any g = createAny();
g.insert_fixed(value, official_type);
return g;
}
}
\ No newline at end of file
/* gnuDynSequence.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
import org.omg.DynamicAny.DynSequence;
import java.io.Serializable;
import java.lang.reflect.*;
public class gnuDynSequence
extends gnuDynArray
implements DynSequence, Serializable
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* The bound of the sequence, as defined in typecode.
*/
final int bound;
/**
* Create a new gnuDynSequence with the given typecode.
*
* @throws BAD_PARAM if the passed typecode is probably not a sequence
* typecode.
*/
public gnuDynSequence(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
throws BAD_PARAM
{
super(oType, aType, aFactory, anOrb, false);
array = new DynAny[ 0 ];
try
{
bound = final_type.length();
}
catch (BadKind ex)
{
throw new Unexpected(ex);
}
}
/**
* Get the length of the sequence.
*/
public int get_length()
{
return array.length;
}
/**
* Resize the sequence, preserving components.
*/
public void set_length(int length)
throws InvalidValue
{
checkBound(length);
if (length == array.length)
return; // Nothing to do.
else if (length < array.length)
{
// Truncate.
DynAny[] d = new DynAny[ length ];
for (int i = 0; i < d.length; i++)
d [ i ] = array [ i ];
array = d;
}
else
{
// Expand.
DynAny[] d = new DynAny[ length ];
for (int i = 0; i < array.length; i++)
d [ i ] = array [ i ];
for (int i = array.length; i < d.length; i++)
{
try
{
d [ i ] =
factory.create_dyn_any_from_type_code(official_components);
}
catch (InconsistentTypeCode e)
{
throw new Unexpected(e);
}
}
array = d;
}
valueChanged();
}
/**
* Copy one DynAny into another.
*/
public void assign(DynAny from)
throws TypeMismatch
{
checkType(official_type, from.type());
if (from instanceof DynSequence)
{
DynSequence dyn = (DynSequence) from;
array = dyn.get_elements_as_dyn_any();
}
else
throw new TypeMismatch();
}
/*
* Set the contenst of the sequence, resizing if required.
*/
public void set_elements_as_dyn_any(DynAny[] value)
throws InvalidValue, TypeMismatch
{
checkBound(value.length);
if (array.length != value.length)
set_length(value.length);
for (int i = 0; i < value.length; i++)
{
checkType(official_components, value [ i ].type());
array [ i ].assign(value [ i ]);
}
valueChanged();
}
/**
* Set the elements from array of Any's.
*/
public void set_elements(Any[] value)
throws InvalidValue, TypeMismatch
{
checkBound(value.length);
DynAny[] prev = array;
array = new DynAny[ value.length ];
try
{
super.set_elements(value);
// valueChanged() is called in super.set_elements(value).
}
// On the problem, value does not change.
catch (TypeMismatch ex)
{
array = prev;
throw ex;
}
catch (InvalidValue ex)
{
array = prev;
throw ex;
}
catch (RuntimeException rex)
{
array = prev;
throw rex;
}
}
/**
* Create a copy.
*/
public DynAny copy()
{
DynAny[] c = new DynAny[ array.length ];
for (int i = 0; i < c.length; i++)
{
c [ i ] = array [ i ].copy();
}
gnuDynSequence d =
new gnuDynSequence(official_type, final_type, factory, orb);
d.array = c;
return d;
}
/**
* Check the bound.
*
* @param x the value to check.
*/
void checkBound(int x)
throws InvalidValue
{
if (bound != 0)
if (x < 0 || x > bound)
throw new InvalidValue(x + " out of bounds, valid [0.." + bound + "]");
}
/**
* Check if array size is valid. Called from from_any.
*/
protected void checkArrayValid(Object members)
throws TypeMismatch, InvalidValue
{
checkBound(Array.getLength(members));
if (get_length() != Array.getLength(members))
set_length(Array.getLength(members));
}
}
\ No newline at end of file
/* gnuDynStruct.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.DynAn;
import java.io.Serializable;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.DynamicAny.DynStruct;
import org.omg.DynamicAny.NameDynAnyPair;
import org.omg.DynamicAny.NameValuePair;
import gnu.CORBA.Unexpected;
import org.omg.DynamicAny.DynAny;
/**
* Implementation of the DynStruct.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynStruct
extends abstractRecord
implements DynStruct, Serializable
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* Create an instance.
*/
public gnuDynStruct(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb)
{
super(oType, aType, aFactory, anOrb);
// Initialise fields.
try
{
array = new DynAny[ final_type.member_count() ];
fNames = new String[ array.length ];
for (int i = 0; i < array.length; i++)
{
array [ i ] =
factory.create_dyn_any_from_type_code(final_type.member_type(i));
fNames [ i ] = final_type.member_name(i);
}
}
catch (Exception e)
{
throw new Unexpected(e);
}
}
/** @inheritDoc */
protected abstractRecord newInstance(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb)
{
return new gnuDynStruct(oType, aType, aFactory, anOrb);
}
/** @inheritDoc */
public NameDynAnyPair[] get_members_as_dyn_any()
{
return super.gnu_get_members_as_dyn_any();
}
/** @inheritDoc */
public NameValuePair[] get_members()
{
return super.gnu_get_members();
}
}
/* valueChangedListener.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.DynAn;
/**
* An interface, able to receive notification about the change of value
* of some DynAny.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public interface valueChangedListener
{
void changed();
}
\ No newline at end of file
/* DynAnySeqHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnySeqHelper;
/**
* A holder for the sequence of {@link DynAny}
* ({@link DynAnySeq}).
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class DynAnySeqHolder
implements Streamable
{
/**
* The stored array of <code>DynAny</code>.
*/
public DynAny[] value;
/**
* Create the unitialised instance, leaving the value array
* with default <code>null</code> value.
*/
public DynAnySeqHolder()
{
}
/**
* Create the initialised instance.
* @param initialValue the array that will be assigned to
* the <code>value</code> array.
*/
public DynAnySeqHolder(DynAny[] initialValue)
{
value = initialValue;
}
/**
* The method should read this object from the CDR input stream, but
* (following the JDK 1.5 API) it does not.
*
* @param input a org.omg.CORBA.portable stream to read from.
*
* @specenote Sun throws the same exception.
*
* @throws MARSHAL always.
*/
public void _read(InputStream input)
{
value = DynAnySeqHelper.read(input);
}
/**
* The method should write this object to the CDR input stream, but
* (following the JDK 1.5 API) it does not.
*
* @param input a org.omg.CORBA.portable stream to read from.
*
* @specenote Sun throws the same exception.
*
* @throws MARSHAL always.
*/
public void _write(OutputStream output)
{
DynAnySeqHelper.write(output, value);
}
/**
* Get the typecode of the DynAny.
*/
public org.omg.CORBA.TypeCode _type()
{
return DynAnySeqHelper.type();
}
}
\ No newline at end of file
/* ForwardRequestHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA;
import gnu.CORBA.Poa.ForwardRequestHolder;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
import org.omg.CORBA.ObjectHelper;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.PortableServer.ForwardRequest;
/**
* The helper operations for the exception {@link ForwardRequest}.
*
* @specnote The helper must be here and not in POA subpackage as it must
* be discovered by the {@link ObjectCreator} when reading this remote
* exception.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public abstract class ForwardRequestHelper
{
/**
* The cached typecode value, computed only once.
*/
private static TypeCode typeCode;
/**
* Extract the ForwardRequest from given Any.
* This method uses the ForwardRequestHolder.
*
* @throws BAD_OPERATION if the passed Any does not contain ForwardRequest.
*/
public static ForwardRequest extract(Any any)
{
try
{
return ((ForwardRequestHolder) any.extract_Streamable()).value;
}
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected");
bad.initCause(cex);
throw bad;
}
}
/**
* Get the ForwardRequest repository id.
*
* @return "ForwardRequest", always.
*/
public static String id()
{
return "ForwardRequest";
}
/**
* Insert the ForwardRequest into the given Any.
* This method uses the ForwardRequestHolder.
*
* @param any the Any to insert into.
* @param that the ForwardRequest to insert.
*/
public static void insert(Any any, ForwardRequest that)
{
any.insert_Streamable(new ForwardRequestHolder(that));
}
/**
* Read the exception from the CDR intput stream.
*
* @param input a org.omg.CORBA.portable stream to read from.
*/
public static ForwardRequest read(InputStream input)
{
// Read the exception repository id.
String id = input.read_string();
ForwardRequest value = new ForwardRequest();
value.forward_reference = input.read_Object();
return value;
}
/**
* Create the ForwardRequest typecode (structure,
* named "ForwardRequest").
* The typecode states that the structure contains the
* following fields: forward_reference.
*/
public static TypeCode type()
{
if (typeCode == null)
{
ORB orb = ORB.init();
StructMember[] members = new StructMember[ 1 ];
TypeCode field;
field = ObjectHelper.type();
members [ 0 ] = new StructMember("forward_reference", field, null);
typeCode = orb.create_exception_tc(id(), "ForwardRequest", members);
}
return typeCode;
}
/**
* Write the exception to the CDR output stream.
*
* @param output a org.omg.CORBA.portable stream stream to write into.
* @param value a value to write.
*/
public static void write(OutputStream output, ForwardRequest value)
{
// Write the exception repository id.
output.write_string(id());
output.write_Object(value.forward_reference);
}
}
\ No newline at end of file
/* contextSupportingHeader.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.GIOP;
import org.omg.CORBA.BAD_INV_ORDER;
/**
* A header, supporting the service contexts. Such header has a context field
* and methods for adding the new contexts.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public abstract class contextSupportingHeader
{
/**
* Empty array, indicating that no service context is available.
*/
protected static final ServiceContext[] NO_CONTEXT = new ServiceContext[0];
/**
* The context data.
*/
public ServiceContext[] service_context = NO_CONTEXT;
/**
* Add service context to this header.
*
* @param context_to_add context to add.
* @param replace if true, the existing context with this ID is replaced.
* Otherwise, BAD_INV_ORDER is throwsn.
*/
public void addContext(org.omg.IOP.ServiceContext context_to_add,
boolean replace)
throws BAD_INV_ORDER
{
service_context = ServiceContext.add(service_context, context_to_add,
replace);
}
}
/* ClientRequestInterceptors.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.Interceptor;
import org.omg.PortableInterceptor.ClientRequestInfo;
import org.omg.PortableInterceptor.ClientRequestInterceptor;
import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
import org.omg.PortableInterceptor.ForwardRequest;
/**
* A block of the all registered ClientRequest interceptors.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class ClientRequestInterceptors
implements ClientRequestInterceptorOperations
{
/**
* The array of all registered ClientRequest interceptors.
*/
private final ClientRequestInterceptor[] interceptors;
/**
* Create the interceptor pack with the registerend interceptor array,
* obtained from the registrator.
*/
public ClientRequestInterceptors(Registrator registrator)
{
interceptors = registrator.getClientRequestInterceptors();
}
/** @inheritDoc */
public void receive_exception(ClientRequestInfo info)
throws ForwardRequest
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].receive_exception(info);
}
}
/** @inheritDoc */
public void receive_other(ClientRequestInfo info) throws ForwardRequest
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].receive_other(info);
}
}
/** @inheritDoc */
public void receive_reply(ClientRequestInfo info)
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].receive_reply(info);
}
}
/** @inheritDoc */
public void send_poll(ClientRequestInfo info)
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].send_poll(info);
}
}
/** @inheritDoc */
public void send_request(ClientRequestInfo info) throws ForwardRequest
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].send_request(info);
}
}
/**
* Call destroy on all registered interceptors.
*/
public void destroy()
{
for (int i = 0; i < interceptors.length; i++)
{
try
{
interceptors [ i ].destroy();
}
catch (Exception exc)
{
// OMG states we should ignore.
}
}
}
/**
* Get the class name.
*/
public String name()
{
return getClass().getName();
}
}
\ No newline at end of file
/* ForwardRequestHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.Interceptor;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
import org.omg.PortableInterceptor.ForwardRequest;
import org.omg.PortableInterceptor.ForwardRequestHelper;
/**
* A holder for the exception {@link ForwardRequest}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class ForwardRequestHolder implements Streamable
{
/**
* The stored ForwardRequest value.
*/
public ForwardRequest value;
/**
* Create the unitialised instance, leaving the value field with default
* <code>null</code> value.
*/
public ForwardRequestHolder()
{
}
/**
* Create the initialised instance.
*
* @param initialValue the value that will be assigned to the
* <code>value</code> field.
*/
public ForwardRequestHolder(ForwardRequest initialValue)
{
value = initialValue;
}
/**
* Fill in the {@link value} by data from the CDR stream.
*
* @param input the org.omg.CORBA.portable stream to read.
*/
public void _read(InputStream input)
{
value = ForwardRequestHelper.read(input);
}
/**
* Write the stored value into the CDR stream.
*
* @param output the org.omg.CORBA.portable stream to write.
*/
public void _write(OutputStream output)
{
ForwardRequestHelper.write(output, value);
}
/**
* Get the typecode of the ForwardRequest.
*/
public TypeCode _type()
{
return ForwardRequestHelper.type();
}
}
\ No newline at end of file
/* IORInterceptors.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.Interceptor;
import org.omg.PortableInterceptor.IORInfo;
import org.omg.PortableInterceptor.IORInterceptor;
import org.omg.PortableInterceptor.IORInterceptorOperations;
/**
* A block of the all registered IOR interceptors.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class IORInterceptors implements IORInterceptorOperations
{
/**
* The array of all registered IOR interceptors.
*/
private final IORInterceptor[] interceptors;
/**
* Create the interceptor pack with the registerend interceptor array,
* obtained from the registrator.
*/
public IORInterceptors(Registrator registrator)
{
interceptors = registrator.getIORInterceptors();
}
/**
* Call this method for all registered interceptors.
*/
public void establish_components(IORInfo info)
{
for (int i = 0; i < interceptors.length; i++)
{
try
{
interceptors [ i ].establish_components(info);
}
catch (Exception exc)
{
// OMG states we should ignore.
}
}
}
/**
* Call destroy on all registered interceptors.
*/
public void destroy()
{
for (int i = 0; i < interceptors.length; i++)
{
try
{
interceptors [ i ].destroy();
}
catch (Exception exc)
{
// OMG states we should ignore.
}
}
}
/**
* Get the class name.
*/
public String name()
{
return getClass().getName();
}
}
\ No newline at end of file
/* ServerRequestInterceptors.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.Interceptor;
import org.omg.PortableInterceptor.ForwardRequest;
import org.omg.PortableInterceptor.ServerRequestInfo;
import org.omg.PortableInterceptor.ServerRequestInterceptor;
import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
/**
* A block of the all registered ServerRequest interceptors.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class ServerRequestInterceptors
implements ServerRequestInterceptorOperations
{
/**
* The array of all registered ServerRequest interceptors.
*/
private final ServerRequestInterceptor[] interceptors;
/**
* Create the interceptor pack with the registerend interceptor array,
* obtained from the registrator.
*/
public ServerRequestInterceptors(Registrator registrator)
{
interceptors = registrator.getServerRequestInterceptors();
}
/** @inheritDoc */
public void receive_request_service_contexts(ServerRequestInfo info)
throws ForwardRequest
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].receive_request_service_contexts(info);
}
}
/** @inheritDoc */
public void receive_request(ServerRequestInfo info) throws ForwardRequest
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].receive_request(info);
}
}
/** @inheritDoc */
public void send_exception(ServerRequestInfo info) throws ForwardRequest
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].send_exception(info);
}
}
/** @inheritDoc */
public void send_other(ServerRequestInfo info) throws ForwardRequest
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].send_other(info);
}
}
/** @inheritDoc */
public void send_reply(ServerRequestInfo info)
{
for (int i = 0; i < interceptors.length; i++)
{
interceptors [ i ].send_reply(info);
}
}
/**
* Call destroy on all registered interceptors.
*/
public void destroy()
{
for (int i = 0; i < interceptors.length; i++)
{
try
{
interceptors [ i ].destroy();
}
catch (Exception exc)
{
// OMG states we should ignore.
}
}
}
/**
* Get the class name.
*/
public String name()
{
return getClass().getName();
}
}
\ No newline at end of file
/* gnuClientRequestInfo.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.Interceptor;
import gnu.CORBA.Unexpected;
import gnu.CORBA.gnuRequest;
import org.omg.CORBA.ARG_IN;
import org.omg.CORBA.ARG_INOUT;
import org.omg.CORBA.ARG_OUT;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.Bounds;
import org.omg.CORBA.ExceptionList;
import org.omg.CORBA.INV_POLICY;
import org.omg.CORBA.LocalObject;
import org.omg.CORBA.NVList;
import org.omg.CORBA.ORB;
import org.omg.CORBA.ParameterMode;
import org.omg.CORBA.Policy;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.Dynamic.Parameter;
import org.omg.IOP.ServiceContext;
import org.omg.IOP.TaggedComponent;
import org.omg.IOP.TaggedProfile;
import org.omg.PortableInterceptor.ClientRequestInfo;
import org.omg.PortableInterceptor.InvalidSlot;
/**
* Client request info. All requests on the client side in Classpath
* implementations are handled via gnuRequest class. This class holds the
* instance of the gnuRequest, accessing the request info this way.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuClientRequestInfo extends LocalObject
implements ClientRequestInfo
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* The request structure, from that some methods take the needed information
* directly. The same request structure cannot be reused in parallel threads,
* the submission methods are synchronized.
*/
private final gnuRequest request;
/**
* Provides possibility to set the wrapped thrown exception explicitly, where
* applicable.
*/
public Any m_wrapped_exception;
/**
* Create the info on the given request.
*/
public gnuClientRequestInfo(gnuRequest a_request)
{
request = a_request;
}
/** @inheritDoc */
public void add_request_service_context(ServiceContext service_context,
boolean replace
)
{
request.add_request_service_context(service_context, replace);
}
/** @inheritDoc */
public TaggedProfile effective_profile()
{
return request.effective_profile();
}
/** @inheritDoc */
public org.omg.CORBA.Object effective_target()
{
return request.effective_target();
}
/** @inheritDoc */
public TaggedComponent get_effective_component(int id)
throws BAD_PARAM
{
return request.get_effective_component(id);
}
/** @inheritDoc */
public TaggedComponent[] get_effective_components(int id)
throws BAD_PARAM
{
return request.get_effective_components(id);
}
/** @inheritDoc */
public Policy get_request_policy(int type) throws INV_POLICY
{
return request.get_request_policy(type);
}
/** @inheritDoc */
public String received_exception_id()
{
try
{
if (m_wrapped_exception != null)
{
return m_wrapped_exception.type().id();
}
else
{
return request.received_exception_id();
}
}
catch (BadKind e)
{
throw new Unexpected(e);
}
}
/** @inheritDoc */
public Any received_exception()
{
if (m_wrapped_exception != null)
{
return m_wrapped_exception;
}
else
{
return request.received_exception();
}
}
/** @inheritDoc */
public org.omg.CORBA.Object target()
{
return request.target();
}
/** @inheritDoc */
public Parameter[] arguments()
{
request.checkDii();
NVList args = request.arguments();
Parameter[] p = new Parameter[ args.count() ];
try
{
for (int i = 0; i < p.length; i++)
{
ParameterMode mode;
switch (args.item(i).flags())
{
case ARG_IN.value :
mode = ParameterMode.PARAM_IN;
break;
case ARG_OUT.value :
mode = ParameterMode.PARAM_OUT;
break;
case ARG_INOUT.value :
mode = ParameterMode.PARAM_INOUT;
break;
default :
throw new Unexpected();
}
p [ i ] = new Parameter(args.item(i).value(), mode);
}
}
catch (Bounds e)
{
throw new Unexpected(e);
}
return p;
}
/** @inheritDoc */
public Any result()
{
request.checkDii();
Any rt = request.return_value();
if (rt == null)
{
ORB orb = request.orb();
rt = orb.create_any();
rt.type(orb.get_primitive_tc(TCKind.tk_void));
return rt;
}
return request.return_value();
}
/** @inheritDoc */
public String[] contexts()
{
return request.ice_contexts();
}
/** @inheritDoc */
public TypeCode[] exceptions()
{
request.checkDii();
ExceptionList ex = request.exceptions();
TypeCode[] et = new TypeCode[ ex.count() ];
try
{
for (int i = 0; i < et.length; i++)
{
et [ i ] = ex.item(i);
}
}
catch (Bounds e)
{
throw new Unexpected(e);
}
return et;
}
/** @inheritDoc */
public org.omg.CORBA.Object forward_reference()
{
return request.forward_reference();
}
/** @inheritDoc */
public String[] operation_context()
{
return request.operation_context();
}
/** @inheritDoc */
public Any get_slot(int id) throws InvalidSlot
{
return request.get_slot(id);
}
/** @inheritDoc */
public String operation()
{
return request.operation();
}
/** @inheritDoc */
public short reply_status()
{
return request.reply_status();
}
/** @inheritDoc */
public int request_id()
{
return request.request_id();
}
/** @inheritDoc */
public boolean response_expected()
{
return request.response_expected();
}
/**
* Determines how far the request shall progress before control is returned to
* the client. However up till JDK 1.5 inclusive this method always returns
* SYNC_WITH_TRANSPORT.
*
* @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT.value (1), always.
*
* @specnote as defined in the Suns 1.5 JDK API.
*/
public short sync_scope()
{
return request.sync_scope();
}
/** @inheritDoc */
public ServiceContext get_reply_service_context(int ctx_name)
throws BAD_PARAM
{
return request.get_reply_service_context(ctx_name);
}
/** @inheritDoc */
public ServiceContext get_request_service_context(int ctx_name)
throws BAD_PARAM
{
return request.get_request_service_context(ctx_name);
}
}
\ No newline at end of file
/* gnuIcCurrent.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.Interceptor;
import gnu.CORBA.CDR.cdrBufOutput;
import gnu.CORBA.Poa.ORB_1_4;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.PortableInterceptor.Current;
import org.omg.PortableInterceptor.CurrentHelper;
import org.omg.PortableInterceptor.InvalidSlot;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
/**
* Supports the "Interceptor current" concept, providing the slot value
* information for the current thread. When making the invocation, this
* information is copied to the Current, returned by ClientRequestInfo.
*
* There is only one instance of this class per ORB. It maintains a thread to
* information map.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuIcCurrent extends ObjectImpl implements Current
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* The ORB, controllin this Current. It provides data about the required size
* of the slot array.
*/
final ORB_1_4 orb;
/**
* The table, mapping threads to records.
*/
private Hashtable threads = new Hashtable();
/**
* An empty array when no slots are defined, computed once.
*/
static final Any[] NO_SLOTS = new Any[ 0 ];
/**
* Create the IC current.
*/
public gnuIcCurrent(ORB_1_4 an_orb)
{
orb = an_orb;
}
/**
* Get the array of POA current repository ids.
*
* @return a single member array, containing value, returned by the
* {@link CurrentHelper#id}, normally
* "IDL:omg.org/PortableInterceptor/Current:1.0".
*/
public String[] _ids()
{
return new String[] { CurrentHelper.id() };
}
/**
* Add the entry to the map.
*/
public void put(Thread t, Any[] record)
{
synchronized (threads)
{
threads.put(t, record);
// Remove non-running threads, avoiding memory leak.
if (threads.size() > 12)
{
Iterator it = threads.entrySet().iterator();
while (it.hasNext())
{
Map.Entry e = (Map.Entry) it.next();
Thread tx = (Thread) e.getKey();
if (!tx.isAlive())
{
it.remove();
}
}
}
}
}
/**
* Check if this thread is registered.
*/
public boolean has(Thread t)
{
synchronized (threads)
{
return threads.containsKey(t);
}
}
/**
* Remove the entry from the map.
*/
public void remove(Thread t)
{
synchronized (threads)
{
threads.remove(t);
}
}
/**
* Get array of all slots, as it is applicable for the current thread. If the
* slots were not previously allocated, they are allocated during this call.
*/
Any[] get_slots()
{
Any[] r;
synchronized (threads)
{
r = (Any[]) threads.get(Thread.currentThread());
if (r == null)
{
r = new Any[ orb.icSlotSize ];
for (int i = 0; i < r.length; i++)
{
Any a = orb.create_any();
a.type(orb.get_primitive_tc(TCKind.tk_null));
r [ i ] = a;
}
put(Thread.currentThread(), r);
}
return r;
}
}
/**
* Get copu array of all slots, as it is applicable for the current thread. If
* the slots were not previously allocated, they are allocated during this
* call.
*/
public Any[] clone_slots()
{
if (orb.icSlotSize == 0)
{
return NO_SLOTS;
}
else
{
Any[] r = get_slots();
Any[] copy = new Any[ r.length ];
cdrBufOutput buf = new cdrBufOutput();
buf.setOrb(orb);
for (int i = 0; i < copy.length; i++)
{
r [ i ].write_value(buf);
}
InputStream input = buf.create_input_stream();
for (int i = 0; i < copy.length; i++)
{
copy [ i ] = orb.create_any();
copy [ i ].read_value(input, r [ i ].type());
}
return copy;
}
}
/**
* Get value for the slot with the given id. If the array of Currents has not
* been yet allocated for the current thread, it is allocated during the
* invocation of this method.
*/
public Any get_slot(int slot_id) throws InvalidSlot, BAD_INV_ORDER
{
try
{
return get_slots() [ slot_id ];
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new InvalidSlot("Slot " + slot_id);
}
}
/**
* Set value for the slot with the given id. If the array of Currents has not
* been yet allocated for the current thread, it is allocated during the
* invocation of this method.
*/
public void set_slot(int slot_id, Any data)
throws InvalidSlot, BAD_INV_ORDER
{
try
{
get_slots() [ slot_id ] = data;
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new InvalidSlot("Slot " + slot_id);
}
}
}
\ No newline at end of file
/* gnuIorInfo.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA.Interceptor;
import gnu.CORBA.IOR;
import gnu.CORBA.Poa.ORB_1_4;
import org.omg.CORBA.LocalObject;
import org.omg.CORBA.Policy;
import org.omg.IOP.TaggedComponent;
import org.omg.PortableInterceptor.IORInfo;
import org.omg.PortableServer.POA;
/**
* Implements IORInfo.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuIorInfo extends LocalObject implements IORInfo
{
/**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1;
/**
* The ORB, to that the IOR is related.
*/
public final ORB_1_4 orb;
/**
* The POA, to that IOR is related.
*/
public final POA poa;
/**
* The IOR itself.
*/
private final IOR ior;
/**
* Create an instance.
*/
public gnuIorInfo(ORB_1_4 an_orb, POA a_poa, IOR an_ior)
{
orb = an_orb;
poa = a_poa;
ior = an_ior;
}
/**
* Add component to tje specified profile of this IOR.
*/
public void add_ior_component_to_profile(TaggedComponent tagged_component,
int profile_id
)
{
ior.add_ior_component_to_profile(tagged_component, profile_id);
}
/**
* Add component to all found profiles in this IOR.
*/
public void add_ior_component(TaggedComponent tagged_component)
{
ior.add_ior_component(tagged_component);
}
/**
* Get the POA policy.
*/
public Policy get_effective_policy(int policy_type)
{
return poa._get_policy(policy_type);
}
/**
* Return the state of the object POA.
*/
short state()
{
return (short) poa.the_POAManager().get_state().value();
}
}
\ No newline at end of file
/* NameDynAnyPairHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
import org.omg.DynamicAny.NameDynAnyPair;
import org.omg.DynamicAny.NameDynAnyPairHelper;
/**
* A holder for the structure {@link NameDynAnyPair}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class NameDynAnyPairHolder
implements Streamable
{
/**
* The stored NameDynAnyPair value.
*/
public NameDynAnyPair value;
/**
* Create the unitialised instance, leaving the value field
* with default <code>null</code> value.
*/
public NameDynAnyPairHolder()
{
}
/**
* Create the initialised instance.
* @param initialValue the value that will be assigned to
* the <code>value</code> field.
*/
public NameDynAnyPairHolder(NameDynAnyPair initialValue)
{
value = initialValue;
}
/**
* The method should read this object from the CDR input stream, but
* (following the JDK 1.5 API) it does not.
*
* @param input a org.omg.CORBA.portable stream to read from.
*
* @specenote Sun throws the same exception.
*
* @throws MARSHAL always.
*/
public void _read(InputStream input)
{
value = NameDynAnyPairHelper.read(input);
}
/**
* The method should write this object to the CDR input stream, but
* (following the JDK 1.5 API) it does not.
*
* @param input a org.omg.CORBA.portable stream to read from.
*
* @specenote Sun throws the same exception.
*
* @throws MARSHAL always.
*/
public void _write(OutputStream output)
{
NameDynAnyPairHelper.write(output, value);
}
/**
* Get the typecode of the NameDynAnyPair.
*/
public org.omg.CORBA.TypeCode _type()
{
return NameDynAnyPairHelper.type();
}
}
\ No newline at end of file
/* NameDynAnyPairSeqHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.CORBA;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
import org.omg.DynamicAny.NameDynAnyPair;
import org.omg.DynamicAny.NameDynAnyPairSeqHelper;
/**
* A holder for the sequence of {@link NameDynAnyPair}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class NameDynAnyPairSeqHolder
implements Streamable
{
/**
* The stored array of <code>NameDynAnyPair</code>.
*/
public NameDynAnyPair[] value;
/**
* Create the unitialised instance, leaving the value array
* with default <code>null</code> value.
*/
public NameDynAnyPairSeqHolder()
{
}
/**
* Create the initialised instance.
* @param initialValue the array that will be assigned to
* the <code>value</code> array.
*/
public NameDynAnyPairSeqHolder(NameDynAnyPair[] initialValue)
{
value = initialValue;
}
/**
* The method should read this object from the CDR input stream, but
* (following the JDK 1.5 API) it does not.
*
* @param input a org.omg.CORBA.portable stream to read from.
*
* @specenote Sun throws the same exception.
*
* @throws MARSHAL always.
*/
public void _read(InputStream input)
{
value = NameDynAnyPairSeqHelper.read(input);
}
/**
* The method should write this object to the CDR input stream, but
* (following the JDK 1.5 API) it does not.
*
* @param input a org.omg.CORBA.portable stream to read from.
*
* @specenote Sun throws the same exception.
*
* @throws MARSHAL always.
*/
public void _write(OutputStream output)
{
NameDynAnyPairSeqHelper.write(output, value);
}
/**
* Get the typecode of the NameDynAnyPair.
*/
public org.omg.CORBA.TypeCode _type()
{
return NameDynAnyPairSeqHelper.type();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment