excercise 2 done
3
.vscode/settings.json
vendored
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"java.compile.nullAnalysis.mode": "automatic"
|
"java.compile.nullAnalysis.mode": "automatic",
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic"
|
||||||
}
|
}
|
||||||
15
week1_TinsaeGhilay/.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
18
week1_TinsaeGhilay/.zed/debug.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// Project-local debug tasks
|
||||||
|
//
|
||||||
|
// For more documentation on how to configure debug tasks,
|
||||||
|
// see: https://zed.dev/docs/debugger
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"adapter": "Java",
|
||||||
|
"request": "launch",
|
||||||
|
"label": "Launch Debugger",
|
||||||
|
// if your project has multiple entry points, specify the one to use:
|
||||||
|
// "mainClass": "com.myorganization.myproject.MyMainClass",
|
||||||
|
//
|
||||||
|
// this effectively sets a breakpoint at your program entry:
|
||||||
|
"stopOnEntry": true,
|
||||||
|
// the working directory for the debug process
|
||||||
|
"cwd": "$ZED_WORKTREE_ROOT"
|
||||||
|
}
|
||||||
|
]
|
||||||
0
week1_TinsaeGhilay/.zed/tasks.json
Normal file
BIN
week1_TinsaeGhilay/Greeter.class
Normal file
BIN
week1_TinsaeGhilay/Main.class
Normal file
62
week1_TinsaeGhilay/Main.java
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello world. This is a demo of Greeter");
|
||||||
|
// I think I hate me
|
||||||
|
Greeter greeter = new Greeter("Fuck you");
|
||||||
|
greeter.greet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Greeter {
|
||||||
|
|
||||||
|
String message;
|
||||||
|
|
||||||
|
// default message
|
||||||
|
public Greeter(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
// greet
|
||||||
|
public void greet() {
|
||||||
|
this.message = getUserInput("What's your message?");
|
||||||
|
String name = getUserInput("Who do you want to say that to?");
|
||||||
|
|
||||||
|
// if no message, we heve nothing to relay
|
||||||
|
if(this.message == null){
|
||||||
|
System.out.println("No messege to relay");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if no name, we have no name to relay massage to
|
||||||
|
if(name == null){
|
||||||
|
System.out.println("No name to relay message to");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// else we print message
|
||||||
|
System.out.println(message + "! " + name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get user input
|
||||||
|
private String getUserInput(String prompt) {
|
||||||
|
System.out.print(prompt + ": ");
|
||||||
|
|
||||||
|
try {
|
||||||
|
String input = "";
|
||||||
|
int i;
|
||||||
|
while ((i = System.in.read()) != '\n') {
|
||||||
|
input = input + (char) i;
|
||||||
|
}
|
||||||
|
if (!input.isEmpty()) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Error reading input");
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
week1_TinsaeGhilay/Task1/Hello.idl
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
module HelloApp
|
||||||
|
{
|
||||||
|
interface Hello
|
||||||
|
{
|
||||||
|
string sayHello();
|
||||||
|
oneway void shutdown();
|
||||||
|
};
|
||||||
|
};
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloApp/Hello.class
Normal file
13
week1_TinsaeGhilay/Task1/HelloApp/Hello.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package HelloApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HelloApp/Hello.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Hello.idl
|
||||||
|
* Sunday, November 9, 2025 2:43:24 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface Hello extends HelloOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
|
||||||
|
{
|
||||||
|
} // interface Hello
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloApp/HelloHelper.class
Normal file
85
week1_TinsaeGhilay/Task1/HelloApp/HelloHelper.java
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
package HelloApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HelloApp/HelloHelper.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Hello.idl
|
||||||
|
* Sunday, November 9, 2025 2:43:24 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract public class HelloHelper
|
||||||
|
{
|
||||||
|
private static String _id = "IDL:HelloApp/Hello:1.0";
|
||||||
|
|
||||||
|
public static void insert (org.omg.CORBA.Any a, HelloApp.Hello that)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
|
||||||
|
a.type (type ());
|
||||||
|
write (out, that);
|
||||||
|
a.read_value (out.create_input_stream (), type ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HelloApp.Hello extract (org.omg.CORBA.Any a)
|
||||||
|
{
|
||||||
|
return read (a.create_input_stream ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.omg.CORBA.TypeCode __typeCode = null;
|
||||||
|
synchronized public static org.omg.CORBA.TypeCode type ()
|
||||||
|
{
|
||||||
|
if (__typeCode == null)
|
||||||
|
{
|
||||||
|
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (HelloApp.HelloHelper.id (), "Hello");
|
||||||
|
}
|
||||||
|
return __typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String id ()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HelloApp.Hello read (org.omg.CORBA.portable.InputStream istream)
|
||||||
|
{
|
||||||
|
return narrow (istream.read_Object (_HelloStub.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write (org.omg.CORBA.portable.OutputStream ostream, HelloApp.Hello value)
|
||||||
|
{
|
||||||
|
ostream.write_Object ((org.omg.CORBA.Object) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HelloApp.Hello narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof HelloApp.Hello)
|
||||||
|
return (HelloApp.Hello)obj;
|
||||||
|
else if (!obj._is_a (id ()))
|
||||||
|
throw new org.omg.CORBA.BAD_PARAM ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
HelloApp._HelloStub stub = new HelloApp._HelloStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HelloApp.Hello unchecked_narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof HelloApp.Hello)
|
||||||
|
return (HelloApp.Hello)obj;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
HelloApp._HelloStub stub = new HelloApp._HelloStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloApp/HelloHolder.class
Normal file
38
week1_TinsaeGhilay/Task1/HelloApp/HelloHolder.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package HelloApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HelloApp/HelloHolder.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Hello.idl
|
||||||
|
* Sunday, November 9, 2025 2:43:24 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final class HelloHolder implements org.omg.CORBA.portable.Streamable
|
||||||
|
{
|
||||||
|
public HelloApp.Hello value = null;
|
||||||
|
|
||||||
|
public HelloHolder ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public HelloHolder (HelloApp.Hello initialValue)
|
||||||
|
{
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _read (org.omg.CORBA.portable.InputStream i)
|
||||||
|
{
|
||||||
|
value = HelloApp.HelloHelper.read (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _write (org.omg.CORBA.portable.OutputStream o)
|
||||||
|
{
|
||||||
|
HelloApp.HelloHelper.write (o, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.TypeCode _type ()
|
||||||
|
{
|
||||||
|
return HelloApp.HelloHelper.type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloApp/HelloOperations.class
Normal file
15
week1_TinsaeGhilay/Task1/HelloApp/HelloOperations.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package HelloApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HelloApp/HelloOperations.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Hello.idl
|
||||||
|
* Sunday, November 9, 2025 2:43:24 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface HelloOperations
|
||||||
|
{
|
||||||
|
String sayHello ();
|
||||||
|
void shutdown ();
|
||||||
|
} // interface HelloOperations
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloApp/HelloPOA.class
Normal file
80
week1_TinsaeGhilay/Task1/HelloApp/HelloPOA.java
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
package HelloApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HelloApp/HelloPOA.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Hello.idl
|
||||||
|
* Sunday, November 9, 2025 2:43:24 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class HelloPOA extends org.omg.PortableServer.Servant
|
||||||
|
implements HelloApp.HelloOperations, org.omg.CORBA.portable.InvokeHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
private static java.util.Hashtable _methods = new java.util.Hashtable ();
|
||||||
|
static
|
||||||
|
{
|
||||||
|
_methods.put ("sayHello", new java.lang.Integer (0));
|
||||||
|
_methods.put ("shutdown", new java.lang.Integer (1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
|
||||||
|
org.omg.CORBA.portable.InputStream in,
|
||||||
|
org.omg.CORBA.portable.ResponseHandler $rh)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = null;
|
||||||
|
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
|
||||||
|
if (__method == null)
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
|
||||||
|
switch (__method.intValue ())
|
||||||
|
{
|
||||||
|
case 0: // HelloApp/Hello/sayHello
|
||||||
|
{
|
||||||
|
String $result = null;
|
||||||
|
$result = this.sayHello ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
out.write_string ($result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 1: // HelloApp/Hello/shutdown
|
||||||
|
{
|
||||||
|
this.shutdown ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
} // _invoke
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:HelloApp/Hello:1.0"};
|
||||||
|
|
||||||
|
public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hello _this()
|
||||||
|
{
|
||||||
|
return HelloHelper.narrow(
|
||||||
|
super._this_object());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hello _this(org.omg.CORBA.ORB orb)
|
||||||
|
{
|
||||||
|
return HelloHelper.narrow(
|
||||||
|
super._this_object(orb));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // class HelloPOA
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloApp/_HelloStub.class
Normal file
88
week1_TinsaeGhilay/Task1/HelloApp/_HelloStub.java
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
package HelloApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HelloApp/_HelloStub.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Hello.idl
|
||||||
|
* Sunday, November 9, 2025 2:43:24 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class _HelloStub extends org.omg.CORBA.portable.ObjectImpl implements HelloApp.Hello
|
||||||
|
{
|
||||||
|
|
||||||
|
public String sayHello ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("sayHello", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
String $result = $in.read_string ();
|
||||||
|
return $result;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
return sayHello ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // sayHello
|
||||||
|
|
||||||
|
public void shutdown ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("shutdown", false);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
shutdown ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // shutdown
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:HelloApp/Hello:1.0"};
|
||||||
|
|
||||||
|
public String[] _ids ()
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String str = s.readUTF ();
|
||||||
|
com.sun.corba.se.impl.orbutil.IORCheckImpl.check(str, "HelloApp._HelloStub");
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.Object obj = orb.string_to_object (str);
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
|
||||||
|
_set_delegate (delegate);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
String str = orb.object_to_string (this);
|
||||||
|
s.writeUTF (str);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // class _HelloStub
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloClient.class
Normal file
38
week1_TinsaeGhilay/Task1/HelloClient.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// Copyright and License
|
||||||
|
|
||||||
|
import HelloApp.*;
|
||||||
|
import org.omg.CORBA.*;
|
||||||
|
import org.omg.CosNaming.*;
|
||||||
|
|
||||||
|
public class HelloClient {
|
||||||
|
|
||||||
|
static Hello helloImpl;
|
||||||
|
|
||||||
|
public static void main(String args[]) {
|
||||||
|
try {
|
||||||
|
// create and initialize the ORB
|
||||||
|
ORB orb = ORB.init(args, null);
|
||||||
|
|
||||||
|
// get the root naming context
|
||||||
|
org.omg.CORBA.Object objRef = orb.resolve_initial_references(
|
||||||
|
"NameService"
|
||||||
|
);
|
||||||
|
// Use NamingContextExt instead of NamingContext. This is
|
||||||
|
// part of the Interoperable naming Service.
|
||||||
|
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
|
||||||
|
|
||||||
|
// resolve the Object Reference in Naming
|
||||||
|
String name = "Hello";
|
||||||
|
helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
|
||||||
|
|
||||||
|
System.out.println(
|
||||||
|
"Obtained a handle on server object: " + helloImpl
|
||||||
|
);
|
||||||
|
System.out.println(helloImpl.sayHello());
|
||||||
|
helloImpl.shutdown();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("ERROR : " + e);
|
||||||
|
e.printStackTrace(System.out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task1/HelloImpl.class
Normal file
BIN
week1_TinsaeGhilay/Task1/HelloServer.class
Normal file
73
week1_TinsaeGhilay/Task1/HelloServer.java
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
// HelloServer.java
|
||||||
|
import HelloApp.*;
|
||||||
|
import org.omg.CosNaming.*;
|
||||||
|
import org.omg.CORBA.*;
|
||||||
|
import org.omg.PortableServer.*;
|
||||||
|
import org.omg.PortableServer.POA;
|
||||||
|
|
||||||
|
|
||||||
|
class HelloImpl extends HelloPOA {
|
||||||
|
private ORB orb;
|
||||||
|
|
||||||
|
public void setORB(ORB orb_val) {
|
||||||
|
orb = orb_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// implement sayHello() method
|
||||||
|
public String sayHello() {
|
||||||
|
return "\nHello world !!\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// implement shutdown() method
|
||||||
|
public void shutdown() {
|
||||||
|
orb.shutdown(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class HelloServer {
|
||||||
|
|
||||||
|
public static void main(String args[]) {
|
||||||
|
try{
|
||||||
|
// create and initialize the ORB
|
||||||
|
ORB orb = ORB.init(args, null);
|
||||||
|
|
||||||
|
// get reference to rootpoa and activate the POAManager
|
||||||
|
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
|
||||||
|
rootpoa.the_POAManager().activate();
|
||||||
|
|
||||||
|
// create servant and register it with the ORB
|
||||||
|
HelloImpl helloImpl = new HelloImpl();
|
||||||
|
helloImpl.setORB(orb);
|
||||||
|
|
||||||
|
// get object reference from the servant
|
||||||
|
org.omg.CORBA.Object ref = rootpoa.servant_to_reference(helloImpl);
|
||||||
|
Hello href = HelloHelper.narrow(ref);
|
||||||
|
|
||||||
|
// get the root naming context
|
||||||
|
org.omg.CORBA.Object objRef =
|
||||||
|
orb.resolve_initial_references("NameService");
|
||||||
|
// Use NamingContextExt which is part of the Interoperable
|
||||||
|
// Naming Service (INS) specification.
|
||||||
|
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
|
||||||
|
|
||||||
|
// bind the Object Reference in Naming
|
||||||
|
String name = "Hello";
|
||||||
|
NameComponent path[] = ncRef.to_name( name );
|
||||||
|
ncRef.rebind(path, href);
|
||||||
|
|
||||||
|
System.out.println("HelloServer ready and waiting ...");
|
||||||
|
|
||||||
|
// wait for invocations from clients
|
||||||
|
orb.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception e) {
|
||||||
|
System.err.println("ERROR: " + e);
|
||||||
|
e.printStackTrace(System.out);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("HelloServer Exiting ...");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/Graph.class
Normal file
53
week1_TinsaeGhilay/Task2/Graphics.idl
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
// task 2.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// module
|
||||||
|
module GraphicsApp
|
||||||
|
{
|
||||||
|
// forward declaration of shape.
|
||||||
|
// because we use it in rectangle
|
||||||
|
interface GraphicalObject;
|
||||||
|
|
||||||
|
typedef sequence<GraphicalObject> ObjectSequence;
|
||||||
|
|
||||||
|
// rectangle contains shapes which GraphicalObjects a
|
||||||
|
interface Rectangle
|
||||||
|
{
|
||||||
|
|
||||||
|
// exception to be thrown if index out of range
|
||||||
|
exception IndexOutOfBounds {};
|
||||||
|
|
||||||
|
// hopping this will be an array of Graphical-objects.
|
||||||
|
attribute ObjectSequence objects;
|
||||||
|
|
||||||
|
// function to add object
|
||||||
|
void addObject(in GraphicalObject newShape);
|
||||||
|
|
||||||
|
// and may be remove an object from a position?
|
||||||
|
void removeObjectAtPosition(in unsigned long index)
|
||||||
|
raises (IndexOutOfBounds);
|
||||||
|
};
|
||||||
|
|
||||||
|
interface Shape
|
||||||
|
{
|
||||||
|
// draw to be overriden in java
|
||||||
|
void draw();
|
||||||
|
|
||||||
|
// and info
|
||||||
|
void showInfo();
|
||||||
|
};
|
||||||
|
|
||||||
|
// GraphicalShape object extends Shape
|
||||||
|
interface GraphicalObject : Shape
|
||||||
|
{
|
||||||
|
// unqualified member
|
||||||
|
attribute boolean is_filled;
|
||||||
|
|
||||||
|
// we cannot set this, so only getter will be implemented.
|
||||||
|
// only time a shape can change is if it's in the matrix or if Dr.Strange is in town.
|
||||||
|
readonly attribute string name;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/GraphicalObject.class
Normal file
15
week1_TinsaeGhilay/Task2/GraphicsApp/GraphicalObject.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/GraphicalObject.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// GraphicalShape object extends Shape
|
||||||
|
public interface GraphicalObject extends GraphicalObjectOperations, GraphicsApp.Shape, org.omg.CORBA.portable.IDLEntity
|
||||||
|
{
|
||||||
|
} // interface GraphicalObject
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/GraphicalObjectHelper.class
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/GraphicalObjectHelper.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// GraphicalShape object extends Shape
|
||||||
|
abstract public class GraphicalObjectHelper
|
||||||
|
{
|
||||||
|
private static String _id = "IDL:GraphicsApp/GraphicalObject:1.0";
|
||||||
|
|
||||||
|
public static void insert (org.omg.CORBA.Any a, GraphicsApp.GraphicalObject that)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
|
||||||
|
a.type (type ());
|
||||||
|
write (out, that);
|
||||||
|
a.read_value (out.create_input_stream (), type ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.GraphicalObject extract (org.omg.CORBA.Any a)
|
||||||
|
{
|
||||||
|
return read (a.create_input_stream ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.omg.CORBA.TypeCode __typeCode = null;
|
||||||
|
synchronized public static org.omg.CORBA.TypeCode type ()
|
||||||
|
{
|
||||||
|
if (__typeCode == null)
|
||||||
|
{
|
||||||
|
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (GraphicsApp.GraphicalObjectHelper.id (), "GraphicalObject");
|
||||||
|
}
|
||||||
|
return __typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String id ()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.GraphicalObject read (org.omg.CORBA.portable.InputStream istream)
|
||||||
|
{
|
||||||
|
return narrow (istream.read_Object (_GraphicalObjectStub.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write (org.omg.CORBA.portable.OutputStream ostream, GraphicsApp.GraphicalObject value)
|
||||||
|
{
|
||||||
|
ostream.write_Object ((org.omg.CORBA.Object) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.GraphicalObject narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof GraphicsApp.GraphicalObject)
|
||||||
|
return (GraphicsApp.GraphicalObject)obj;
|
||||||
|
else if (!obj._is_a (id ()))
|
||||||
|
throw new org.omg.CORBA.BAD_PARAM ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
GraphicsApp._GraphicalObjectStub stub = new GraphicsApp._GraphicalObjectStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.GraphicalObject unchecked_narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof GraphicsApp.GraphicalObject)
|
||||||
|
return (GraphicsApp.GraphicalObject)obj;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
GraphicsApp._GraphicalObjectStub stub = new GraphicsApp._GraphicalObjectStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/GraphicalObjectHolder.class
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/GraphicalObjectHolder.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// GraphicalShape object extends Shape
|
||||||
|
public final class GraphicalObjectHolder implements org.omg.CORBA.portable.Streamable
|
||||||
|
{
|
||||||
|
public GraphicsApp.GraphicalObject value = null;
|
||||||
|
|
||||||
|
public GraphicalObjectHolder ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public GraphicalObjectHolder (GraphicsApp.GraphicalObject initialValue)
|
||||||
|
{
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _read (org.omg.CORBA.portable.InputStream i)
|
||||||
|
{
|
||||||
|
value = GraphicsApp.GraphicalObjectHelper.read (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _write (org.omg.CORBA.portable.OutputStream o)
|
||||||
|
{
|
||||||
|
GraphicsApp.GraphicalObjectHelper.write (o, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.TypeCode _type ()
|
||||||
|
{
|
||||||
|
return GraphicsApp.GraphicalObjectHelper.type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/GraphicalObjectOperations.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// GraphicalShape object extends Shape
|
||||||
|
public interface GraphicalObjectOperations extends GraphicsApp.ShapeOperations
|
||||||
|
{
|
||||||
|
|
||||||
|
// unqualified member
|
||||||
|
boolean is_filled ();
|
||||||
|
|
||||||
|
// unqualified member
|
||||||
|
void is_filled (boolean newIs_filled);
|
||||||
|
|
||||||
|
// only time a shape can change is if it's in the matrix or if Dr.Strange is in town.
|
||||||
|
String name ();
|
||||||
|
} // interface GraphicalObjectOperations
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/GraphicalObjectPOA.class
Normal file
120
week1_TinsaeGhilay/Task2/GraphicsApp/GraphicalObjectPOA.java
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/GraphicalObjectPOA.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// GraphicalShape object extends Shape
|
||||||
|
public abstract class GraphicalObjectPOA extends org.omg.PortableServer.Servant
|
||||||
|
implements GraphicsApp.GraphicalObjectOperations, org.omg.CORBA.portable.InvokeHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
private static java.util.Hashtable _methods = new java.util.Hashtable ();
|
||||||
|
static
|
||||||
|
{
|
||||||
|
_methods.put ("_get_is_filled", new java.lang.Integer (0));
|
||||||
|
_methods.put ("_set_is_filled", new java.lang.Integer (1));
|
||||||
|
_methods.put ("_get_name", new java.lang.Integer (2));
|
||||||
|
_methods.put ("draw", new java.lang.Integer (3));
|
||||||
|
_methods.put ("showInfo", new java.lang.Integer (4));
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
|
||||||
|
org.omg.CORBA.portable.InputStream in,
|
||||||
|
org.omg.CORBA.portable.ResponseHandler $rh)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = null;
|
||||||
|
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
|
||||||
|
if (__method == null)
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
|
||||||
|
switch (__method.intValue ())
|
||||||
|
{
|
||||||
|
|
||||||
|
// unqualified member
|
||||||
|
case 0: // GraphicsApp/GraphicalObject/_get_is_filled
|
||||||
|
{
|
||||||
|
boolean $result = false;
|
||||||
|
$result = this.is_filled ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
out.write_boolean ($result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// unqualified member
|
||||||
|
case 1: // GraphicsApp/GraphicalObject/_set_is_filled
|
||||||
|
{
|
||||||
|
boolean newIs_filled = in.read_boolean ();
|
||||||
|
this.is_filled (newIs_filled);
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// only time a shape can change is if it's in the matrix or if Dr.Strange is in town.
|
||||||
|
case 2: // GraphicsApp/GraphicalObject/_get_name
|
||||||
|
{
|
||||||
|
String $result = null;
|
||||||
|
$result = this.name ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
out.write_string ($result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// draw to be overriden in java
|
||||||
|
case 3: // GraphicsApp/Shape/draw
|
||||||
|
{
|
||||||
|
this.draw ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// and info
|
||||||
|
case 4: // GraphicsApp/Shape/showInfo
|
||||||
|
{
|
||||||
|
this.showInfo ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
} // _invoke
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:GraphicsApp/GraphicalObject:1.0",
|
||||||
|
"IDL:GraphicsApp/Shape:1.0"};
|
||||||
|
|
||||||
|
public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GraphicalObject _this()
|
||||||
|
{
|
||||||
|
return GraphicalObjectHelper.narrow(
|
||||||
|
super._this_object());
|
||||||
|
}
|
||||||
|
|
||||||
|
public GraphicalObject _this(org.omg.CORBA.ORB orb)
|
||||||
|
{
|
||||||
|
return GraphicalObjectHelper.narrow(
|
||||||
|
super._this_object(orb));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // class GraphicalObjectPOA
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/ObjectSequenceHelper.class
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/ObjectSequenceHelper.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract public class ObjectSequenceHelper
|
||||||
|
{
|
||||||
|
private static String _id = "IDL:GraphicsApp/ObjectSequence:1.0";
|
||||||
|
|
||||||
|
public static void insert (org.omg.CORBA.Any a, GraphicsApp.GraphicalObject[] that)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
|
||||||
|
a.type (type ());
|
||||||
|
write (out, that);
|
||||||
|
a.read_value (out.create_input_stream (), type ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.GraphicalObject[] extract (org.omg.CORBA.Any a)
|
||||||
|
{
|
||||||
|
return read (a.create_input_stream ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.omg.CORBA.TypeCode __typeCode = null;
|
||||||
|
synchronized public static org.omg.CORBA.TypeCode type ()
|
||||||
|
{
|
||||||
|
if (__typeCode == null)
|
||||||
|
{
|
||||||
|
__typeCode = GraphicsApp.GraphicalObjectHelper.type ();
|
||||||
|
__typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
|
||||||
|
__typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (GraphicsApp.ObjectSequenceHelper.id (), "ObjectSequence", __typeCode);
|
||||||
|
}
|
||||||
|
return __typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String id ()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.GraphicalObject[] read (org.omg.CORBA.portable.InputStream istream)
|
||||||
|
{
|
||||||
|
GraphicsApp.GraphicalObject value[] = null;
|
||||||
|
int _len0 = istream.read_long ();
|
||||||
|
value = new GraphicsApp.GraphicalObject[_len0];
|
||||||
|
for (int _o1 = 0;_o1 < value.length; ++_o1)
|
||||||
|
value[_o1] = GraphicsApp.GraphicalObjectHelper.read (istream);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write (org.omg.CORBA.portable.OutputStream ostream, GraphicsApp.GraphicalObject[] value)
|
||||||
|
{
|
||||||
|
ostream.write_long (value.length);
|
||||||
|
for (int _i0 = 0;_i0 < value.length; ++_i0)
|
||||||
|
GraphicsApp.GraphicalObjectHelper.write (ostream, value[_i0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/ObjectSequenceHolder.class
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/ObjectSequenceHolder.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final class ObjectSequenceHolder implements org.omg.CORBA.portable.Streamable
|
||||||
|
{
|
||||||
|
public GraphicsApp.GraphicalObject value[] = null;
|
||||||
|
|
||||||
|
public ObjectSequenceHolder ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectSequenceHolder (GraphicsApp.GraphicalObject[] initialValue)
|
||||||
|
{
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _read (org.omg.CORBA.portable.InputStream i)
|
||||||
|
{
|
||||||
|
value = GraphicsApp.ObjectSequenceHelper.read (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _write (org.omg.CORBA.portable.OutputStream o)
|
||||||
|
{
|
||||||
|
GraphicsApp.ObjectSequenceHelper.write (o, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.TypeCode _type ()
|
||||||
|
{
|
||||||
|
return GraphicsApp.ObjectSequenceHelper.type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/Rectangle.class
Normal file
15
week1_TinsaeGhilay/Task2/GraphicsApp/Rectangle.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/Rectangle.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// rectangle contains shapes which GraphicalObjects a
|
||||||
|
public interface Rectangle extends RectangleOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
|
||||||
|
{
|
||||||
|
} // interface Rectangle
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/RectangleHelper.class
Normal file
87
week1_TinsaeGhilay/Task2/GraphicsApp/RectangleHelper.java
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/RectangleHelper.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// rectangle contains shapes which GraphicalObjects a
|
||||||
|
abstract public class RectangleHelper
|
||||||
|
{
|
||||||
|
private static String _id = "IDL:GraphicsApp/Rectangle:1.0";
|
||||||
|
|
||||||
|
public static void insert (org.omg.CORBA.Any a, GraphicsApp.Rectangle that)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
|
||||||
|
a.type (type ());
|
||||||
|
write (out, that);
|
||||||
|
a.read_value (out.create_input_stream (), type ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Rectangle extract (org.omg.CORBA.Any a)
|
||||||
|
{
|
||||||
|
return read (a.create_input_stream ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.omg.CORBA.TypeCode __typeCode = null;
|
||||||
|
synchronized public static org.omg.CORBA.TypeCode type ()
|
||||||
|
{
|
||||||
|
if (__typeCode == null)
|
||||||
|
{
|
||||||
|
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (GraphicsApp.RectangleHelper.id (), "Rectangle");
|
||||||
|
}
|
||||||
|
return __typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String id ()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Rectangle read (org.omg.CORBA.portable.InputStream istream)
|
||||||
|
{
|
||||||
|
return narrow (istream.read_Object (_RectangleStub.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write (org.omg.CORBA.portable.OutputStream ostream, GraphicsApp.Rectangle value)
|
||||||
|
{
|
||||||
|
ostream.write_Object ((org.omg.CORBA.Object) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Rectangle narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof GraphicsApp.Rectangle)
|
||||||
|
return (GraphicsApp.Rectangle)obj;
|
||||||
|
else if (!obj._is_a (id ()))
|
||||||
|
throw new org.omg.CORBA.BAD_PARAM ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
GraphicsApp._RectangleStub stub = new GraphicsApp._RectangleStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Rectangle unchecked_narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof GraphicsApp.Rectangle)
|
||||||
|
return (GraphicsApp.Rectangle)obj;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
GraphicsApp._RectangleStub stub = new GraphicsApp._RectangleStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/RectangleHolder.class
Normal file
40
week1_TinsaeGhilay/Task2/GraphicsApp/RectangleHolder.java
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/RectangleHolder.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// rectangle contains shapes which GraphicalObjects a
|
||||||
|
public final class RectangleHolder implements org.omg.CORBA.portable.Streamable
|
||||||
|
{
|
||||||
|
public GraphicsApp.Rectangle value = null;
|
||||||
|
|
||||||
|
public RectangleHolder ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public RectangleHolder (GraphicsApp.Rectangle initialValue)
|
||||||
|
{
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _read (org.omg.CORBA.portable.InputStream i)
|
||||||
|
{
|
||||||
|
value = GraphicsApp.RectangleHelper.read (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _write (org.omg.CORBA.portable.OutputStream o)
|
||||||
|
{
|
||||||
|
GraphicsApp.RectangleHelper.write (o, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.TypeCode _type ()
|
||||||
|
{
|
||||||
|
return GraphicsApp.RectangleHelper.type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/RectangleOperations.class
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/RectangleOperations.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// rectangle contains shapes which GraphicalObjects a
|
||||||
|
public interface RectangleOperations
|
||||||
|
{
|
||||||
|
|
||||||
|
// hopping this will be an array of shapes.
|
||||||
|
GraphicsApp.GraphicalObject[] objects ();
|
||||||
|
|
||||||
|
// hopping this will be an array of shapes.
|
||||||
|
void objects (GraphicsApp.GraphicalObject[] newObjects);
|
||||||
|
|
||||||
|
// function to add shape
|
||||||
|
void addObject (GraphicsApp.GraphicalObject newShape);
|
||||||
|
|
||||||
|
// and may be remove a shape from a position?
|
||||||
|
void removeObjectAtPosition (int index) throws GraphicsApp.RectanglePackage.IndexOutOfBounds;
|
||||||
|
} // interface RectangleOperations
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/RectanglePOA.class
Normal file
114
week1_TinsaeGhilay/Task2/GraphicsApp/RectanglePOA.java
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/RectanglePOA.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// rectangle contains shapes which GraphicalObjects a
|
||||||
|
public abstract class RectanglePOA extends org.omg.PortableServer.Servant
|
||||||
|
implements GraphicsApp.RectangleOperations, org.omg.CORBA.portable.InvokeHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
private static java.util.Hashtable _methods = new java.util.Hashtable ();
|
||||||
|
static
|
||||||
|
{
|
||||||
|
_methods.put ("_get_objects", new java.lang.Integer (0));
|
||||||
|
_methods.put ("_set_objects", new java.lang.Integer (1));
|
||||||
|
_methods.put ("addObject", new java.lang.Integer (2));
|
||||||
|
_methods.put ("removeObjectAtPosition", new java.lang.Integer (3));
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
|
||||||
|
org.omg.CORBA.portable.InputStream in,
|
||||||
|
org.omg.CORBA.portable.ResponseHandler $rh)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = null;
|
||||||
|
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
|
||||||
|
if (__method == null)
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
|
||||||
|
switch (__method.intValue ())
|
||||||
|
{
|
||||||
|
|
||||||
|
// hopping this will be an array of shapes.
|
||||||
|
case 0: // GraphicsApp/Rectangle/_get_objects
|
||||||
|
{
|
||||||
|
GraphicsApp.GraphicalObject $result[] = null;
|
||||||
|
$result = this.objects ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
GraphicsApp.ObjectSequenceHelper.write (out, $result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// hopping this will be an array of shapes.
|
||||||
|
case 1: // GraphicsApp/Rectangle/_set_objects
|
||||||
|
{
|
||||||
|
GraphicsApp.GraphicalObject newObjects[] = GraphicsApp.ObjectSequenceHelper.read (in);
|
||||||
|
this.objects (newObjects);
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function to add shape
|
||||||
|
case 2: // GraphicsApp/Rectangle/addObject
|
||||||
|
{
|
||||||
|
GraphicsApp.GraphicalObject newShape = GraphicsApp.GraphicalObjectHelper.read (in);
|
||||||
|
this.addObject (newShape);
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// and may be remove a shape from a position?
|
||||||
|
case 3: // GraphicsApp/Rectangle/removeObjectAtPosition
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
int index = in.read_ulong ();
|
||||||
|
this.removeObjectAtPosition (index);
|
||||||
|
out = $rh.createReply();
|
||||||
|
} catch (GraphicsApp.RectanglePackage.IndexOutOfBounds $ex) {
|
||||||
|
out = $rh.createExceptionReply ();
|
||||||
|
GraphicsApp.RectanglePackage.IndexOutOfBoundsHelper.write (out, $ex);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
} // _invoke
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:GraphicsApp/Rectangle:1.0"};
|
||||||
|
|
||||||
|
public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle _this()
|
||||||
|
{
|
||||||
|
return RectangleHelper.narrow(
|
||||||
|
super._this_object());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle _this(org.omg.CORBA.ORB orb)
|
||||||
|
{
|
||||||
|
return RectangleHelper.narrow(
|
||||||
|
super._this_object(orb));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // class RectanglePOA
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package GraphicsApp.RectanglePackage;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/RectanglePackage/IndexOutOfBounds.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final class IndexOutOfBounds extends org.omg.CORBA.UserException
|
||||||
|
{
|
||||||
|
|
||||||
|
public IndexOutOfBounds ()
|
||||||
|
{
|
||||||
|
super(IndexOutOfBoundsHelper.id());
|
||||||
|
} // ctor
|
||||||
|
|
||||||
|
|
||||||
|
public IndexOutOfBounds (String $reason)
|
||||||
|
{
|
||||||
|
super(IndexOutOfBoundsHelper.id() + " " + $reason);
|
||||||
|
} // ctor
|
||||||
|
|
||||||
|
} // class IndexOutOfBounds
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package GraphicsApp.RectanglePackage;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/RectanglePackage/IndexOutOfBoundsHelper.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract public class IndexOutOfBoundsHelper
|
||||||
|
{
|
||||||
|
private static String _id = "IDL:GraphicsApp/Rectangle/IndexOutOfBounds:1.0";
|
||||||
|
|
||||||
|
public static void insert (org.omg.CORBA.Any a, GraphicsApp.RectanglePackage.IndexOutOfBounds that)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
|
||||||
|
a.type (type ());
|
||||||
|
write (out, that);
|
||||||
|
a.read_value (out.create_input_stream (), type ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.RectanglePackage.IndexOutOfBounds extract (org.omg.CORBA.Any a)
|
||||||
|
{
|
||||||
|
return read (a.create_input_stream ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.omg.CORBA.TypeCode __typeCode = null;
|
||||||
|
private static boolean __active = false;
|
||||||
|
synchronized public static org.omg.CORBA.TypeCode type ()
|
||||||
|
{
|
||||||
|
if (__typeCode == null)
|
||||||
|
{
|
||||||
|
synchronized (org.omg.CORBA.TypeCode.class)
|
||||||
|
{
|
||||||
|
if (__typeCode == null)
|
||||||
|
{
|
||||||
|
if (__active)
|
||||||
|
{
|
||||||
|
return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
|
||||||
|
}
|
||||||
|
__active = true;
|
||||||
|
org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0];
|
||||||
|
org.omg.CORBA.TypeCode _tcOf_members0 = null;
|
||||||
|
__typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (GraphicsApp.RectanglePackage.IndexOutOfBoundsHelper.id (), "IndexOutOfBounds", _members0);
|
||||||
|
__active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return __typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String id ()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.RectanglePackage.IndexOutOfBounds read (org.omg.CORBA.portable.InputStream istream)
|
||||||
|
{
|
||||||
|
GraphicsApp.RectanglePackage.IndexOutOfBounds value = new GraphicsApp.RectanglePackage.IndexOutOfBounds ();
|
||||||
|
// read and discard the repository ID
|
||||||
|
istream.read_string ();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write (org.omg.CORBA.portable.OutputStream ostream, GraphicsApp.RectanglePackage.IndexOutOfBounds value)
|
||||||
|
{
|
||||||
|
// write the repository ID
|
||||||
|
ostream.write_string (id ());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package GraphicsApp.RectanglePackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/RectanglePackage/IndexOutOfBoundsHolder.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final class IndexOutOfBoundsHolder implements org.omg.CORBA.portable.Streamable
|
||||||
|
{
|
||||||
|
public GraphicsApp.RectanglePackage.IndexOutOfBounds value = null;
|
||||||
|
|
||||||
|
public IndexOutOfBoundsHolder ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexOutOfBoundsHolder (GraphicsApp.RectanglePackage.IndexOutOfBounds initialValue)
|
||||||
|
{
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _read (org.omg.CORBA.portable.InputStream i)
|
||||||
|
{
|
||||||
|
value = GraphicsApp.RectanglePackage.IndexOutOfBoundsHelper.read (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _write (org.omg.CORBA.portable.OutputStream o)
|
||||||
|
{
|
||||||
|
GraphicsApp.RectanglePackage.IndexOutOfBoundsHelper.write (o, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.TypeCode _type ()
|
||||||
|
{
|
||||||
|
return GraphicsApp.RectanglePackage.IndexOutOfBoundsHelper.type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/Shape.class
Normal file
13
week1_TinsaeGhilay/Task2/GraphicsApp/Shape.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/Shape.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface Shape extends ShapeOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
|
||||||
|
{
|
||||||
|
} // interface Shape
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/ShapeHelper.class
Normal file
85
week1_TinsaeGhilay/Task2/GraphicsApp/ShapeHelper.java
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/ShapeHelper.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract public class ShapeHelper
|
||||||
|
{
|
||||||
|
private static String _id = "IDL:GraphicsApp/Shape:1.0";
|
||||||
|
|
||||||
|
public static void insert (org.omg.CORBA.Any a, GraphicsApp.Shape that)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
|
||||||
|
a.type (type ());
|
||||||
|
write (out, that);
|
||||||
|
a.read_value (out.create_input_stream (), type ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Shape extract (org.omg.CORBA.Any a)
|
||||||
|
{
|
||||||
|
return read (a.create_input_stream ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.omg.CORBA.TypeCode __typeCode = null;
|
||||||
|
synchronized public static org.omg.CORBA.TypeCode type ()
|
||||||
|
{
|
||||||
|
if (__typeCode == null)
|
||||||
|
{
|
||||||
|
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (GraphicsApp.ShapeHelper.id (), "Shape");
|
||||||
|
}
|
||||||
|
return __typeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String id ()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Shape read (org.omg.CORBA.portable.InputStream istream)
|
||||||
|
{
|
||||||
|
return narrow (istream.read_Object (_ShapeStub.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void write (org.omg.CORBA.portable.OutputStream ostream, GraphicsApp.Shape value)
|
||||||
|
{
|
||||||
|
ostream.write_Object ((org.omg.CORBA.Object) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Shape narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof GraphicsApp.Shape)
|
||||||
|
return (GraphicsApp.Shape)obj;
|
||||||
|
else if (!obj._is_a (id ()))
|
||||||
|
throw new org.omg.CORBA.BAD_PARAM ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
GraphicsApp._ShapeStub stub = new GraphicsApp._ShapeStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GraphicsApp.Shape unchecked_narrow (org.omg.CORBA.Object obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
return null;
|
||||||
|
else if (obj instanceof GraphicsApp.Shape)
|
||||||
|
return (GraphicsApp.Shape)obj;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
|
||||||
|
GraphicsApp._ShapeStub stub = new GraphicsApp._ShapeStub ();
|
||||||
|
stub._set_delegate(delegate);
|
||||||
|
return stub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/ShapeHolder.class
Normal file
38
week1_TinsaeGhilay/Task2/GraphicsApp/ShapeHolder.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/ShapeHolder.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final class ShapeHolder implements org.omg.CORBA.portable.Streamable
|
||||||
|
{
|
||||||
|
public GraphicsApp.Shape value = null;
|
||||||
|
|
||||||
|
public ShapeHolder ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShapeHolder (GraphicsApp.Shape initialValue)
|
||||||
|
{
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _read (org.omg.CORBA.portable.InputStream i)
|
||||||
|
{
|
||||||
|
value = GraphicsApp.ShapeHelper.read (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void _write (org.omg.CORBA.portable.OutputStream o)
|
||||||
|
{
|
||||||
|
GraphicsApp.ShapeHelper.write (o, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.TypeCode _type ()
|
||||||
|
{
|
||||||
|
return GraphicsApp.ShapeHelper.type ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/ShapeOperations.class
Normal file
19
week1_TinsaeGhilay/Task2/GraphicsApp/ShapeOperations.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/ShapeOperations.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ShapeOperations
|
||||||
|
{
|
||||||
|
|
||||||
|
// draw to be overriden in java
|
||||||
|
void draw ();
|
||||||
|
|
||||||
|
// and info
|
||||||
|
void showInfo ();
|
||||||
|
} // interface ShapeOperations
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/ShapePOA.class
Normal file
82
week1_TinsaeGhilay/Task2/GraphicsApp/ShapePOA.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/ShapePOA.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class ShapePOA extends org.omg.PortableServer.Servant
|
||||||
|
implements GraphicsApp.ShapeOperations, org.omg.CORBA.portable.InvokeHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
private static java.util.Hashtable _methods = new java.util.Hashtable ();
|
||||||
|
static
|
||||||
|
{
|
||||||
|
_methods.put ("draw", new java.lang.Integer (0));
|
||||||
|
_methods.put ("showInfo", new java.lang.Integer (1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
|
||||||
|
org.omg.CORBA.portable.InputStream in,
|
||||||
|
org.omg.CORBA.portable.ResponseHandler $rh)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.OutputStream out = null;
|
||||||
|
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
|
||||||
|
if (__method == null)
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
|
||||||
|
switch (__method.intValue ())
|
||||||
|
{
|
||||||
|
|
||||||
|
// draw to be overriden in java
|
||||||
|
case 0: // GraphicsApp/Shape/draw
|
||||||
|
{
|
||||||
|
this.draw ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// and info
|
||||||
|
case 1: // GraphicsApp/Shape/showInfo
|
||||||
|
{
|
||||||
|
this.showInfo ();
|
||||||
|
out = $rh.createReply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
} // _invoke
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:GraphicsApp/Shape:1.0"};
|
||||||
|
|
||||||
|
public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Shape _this()
|
||||||
|
{
|
||||||
|
return ShapeHelper.narrow(
|
||||||
|
super._this_object());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Shape _this(org.omg.CORBA.ORB orb)
|
||||||
|
{
|
||||||
|
return ShapeHelper.narrow(
|
||||||
|
super._this_object(orb));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // class ShapePOA
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/_GraphicalObjectStub.class
Normal file
157
week1_TinsaeGhilay/Task2/GraphicsApp/_GraphicalObjectStub.java
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/_GraphicalObjectStub.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// GraphicalShape object extends Shape
|
||||||
|
public class _GraphicalObjectStub extends org.omg.CORBA.portable.ObjectImpl implements GraphicsApp.GraphicalObject
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// unqualified member
|
||||||
|
public boolean is_filled ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("_get_is_filled", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
boolean $result = $in.read_boolean ();
|
||||||
|
return $result;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
return is_filled ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // is_filled
|
||||||
|
|
||||||
|
|
||||||
|
// unqualified member
|
||||||
|
public void is_filled (boolean newIs_filled)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("_set_is_filled", true);
|
||||||
|
$out.write_boolean (newIs_filled);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
is_filled (newIs_filled );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // is_filled
|
||||||
|
|
||||||
|
|
||||||
|
// only time a shape can change is if it's in the matrix or if Dr.Strange is in town.
|
||||||
|
public String name ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("_get_name", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
String $result = $in.read_string ();
|
||||||
|
return $result;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
return name ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // name
|
||||||
|
|
||||||
|
|
||||||
|
// draw to be overriden in java
|
||||||
|
public void draw ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("draw", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
draw ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // draw
|
||||||
|
|
||||||
|
|
||||||
|
// and info
|
||||||
|
public void showInfo ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("showInfo", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
showInfo ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // showInfo
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:GraphicsApp/GraphicalObject:1.0",
|
||||||
|
"IDL:GraphicsApp/Shape:1.0"};
|
||||||
|
|
||||||
|
public String[] _ids ()
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String str = s.readUTF ();
|
||||||
|
com.sun.corba.se.impl.orbutil.IORCheckImpl.check(str, "GraphicsApp._GraphicalObjectStub");
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.Object obj = orb.string_to_object (str);
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
|
||||||
|
_set_delegate (delegate);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
String str = orb.object_to_string (this);
|
||||||
|
s.writeUTF (str);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // class _GraphicalObjectStub
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/_RectangleStub.class
Normal file
140
week1_TinsaeGhilay/Task2/GraphicsApp/_RectangleStub.java
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/_RectangleStub.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// rectangle contains shapes which GraphicalObjects a
|
||||||
|
public class _RectangleStub extends org.omg.CORBA.portable.ObjectImpl implements GraphicsApp.Rectangle
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// hopping this will be an array of shapes.
|
||||||
|
public GraphicsApp.GraphicalObject[] objects ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("_get_objects", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
GraphicsApp.GraphicalObject $result[] = GraphicsApp.ObjectSequenceHelper.read ($in);
|
||||||
|
return $result;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
return objects ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // objects
|
||||||
|
|
||||||
|
|
||||||
|
// hopping this will be an array of shapes.
|
||||||
|
public void objects (GraphicsApp.GraphicalObject[] newObjects)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("_set_objects", true);
|
||||||
|
GraphicsApp.ObjectSequenceHelper.write ($out, newObjects);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
objects (newObjects );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // objects
|
||||||
|
|
||||||
|
|
||||||
|
// function to add shape
|
||||||
|
public void addObject (GraphicsApp.GraphicalObject newShape)
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("addObject", true);
|
||||||
|
GraphicsApp.GraphicalObjectHelper.write ($out, newShape);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
addObject (newShape );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // addObject
|
||||||
|
|
||||||
|
|
||||||
|
// and may be remove a shape from a position?
|
||||||
|
public void removeObjectAtPosition (int index) throws GraphicsApp.RectanglePackage.IndexOutOfBounds
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("removeObjectAtPosition", true);
|
||||||
|
$out.write_ulong (index);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
if (_id.equals ("IDL:GraphicsApp/Rectangle/IndexOutOfBounds:1.0"))
|
||||||
|
throw GraphicsApp.RectanglePackage.IndexOutOfBoundsHelper.read ($in);
|
||||||
|
else
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
removeObjectAtPosition (index );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // removeObjectAtPosition
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:GraphicsApp/Rectangle:1.0"};
|
||||||
|
|
||||||
|
public String[] _ids ()
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String str = s.readUTF ();
|
||||||
|
com.sun.corba.se.impl.orbutil.IORCheckImpl.check(str, "GraphicsApp._RectangleStub");
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.Object obj = orb.string_to_object (str);
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
|
||||||
|
_set_delegate (delegate);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
String str = orb.object_to_string (this);
|
||||||
|
s.writeUTF (str);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // class _RectangleStub
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsApp/_ShapeStub.class
Normal file
91
week1_TinsaeGhilay/Task2/GraphicsApp/_ShapeStub.java
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
package GraphicsApp;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphicsApp/_ShapeStub.java .
|
||||||
|
* Generated by the IDL-to-Java compiler (portable), version "3.2"
|
||||||
|
* from Graphics.idl
|
||||||
|
* Tuesday, November 11, 2025 6:46:29 PM CET
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class _ShapeStub extends org.omg.CORBA.portable.ObjectImpl implements GraphicsApp.Shape
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// draw to be overriden in java
|
||||||
|
public void draw ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("draw", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
draw ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // draw
|
||||||
|
|
||||||
|
|
||||||
|
// and info
|
||||||
|
public void showInfo ()
|
||||||
|
{
|
||||||
|
org.omg.CORBA.portable.InputStream $in = null;
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.portable.OutputStream $out = _request ("showInfo", true);
|
||||||
|
$in = _invoke ($out);
|
||||||
|
return;
|
||||||
|
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
|
||||||
|
$in = $ex.getInputStream ();
|
||||||
|
String _id = $ex.getId ();
|
||||||
|
throw new org.omg.CORBA.MARSHAL (_id);
|
||||||
|
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
|
||||||
|
showInfo ( );
|
||||||
|
} finally {
|
||||||
|
_releaseReply ($in);
|
||||||
|
}
|
||||||
|
} // showInfo
|
||||||
|
|
||||||
|
// Type-specific CORBA::Object operations
|
||||||
|
private static String[] __ids = {
|
||||||
|
"IDL:GraphicsApp/Shape:1.0"};
|
||||||
|
|
||||||
|
public String[] _ids ()
|
||||||
|
{
|
||||||
|
return (String[])__ids.clone ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String str = s.readUTF ();
|
||||||
|
com.sun.corba.se.impl.orbutil.IORCheckImpl.check(str, "GraphicsApp._ShapeStub");
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
org.omg.CORBA.Object obj = orb.string_to_object (str);
|
||||||
|
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
|
||||||
|
_set_delegate (delegate);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
|
||||||
|
{
|
||||||
|
String[] args = null;
|
||||||
|
java.util.Properties props = null;
|
||||||
|
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);
|
||||||
|
try {
|
||||||
|
String str = orb.object_to_string (this);
|
||||||
|
s.writeUTF (str);
|
||||||
|
} finally {
|
||||||
|
orb.destroy() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // class _ShapeStub
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsClient.class
Normal file
98
week1_TinsaeGhilay/Task2/GraphicsClient.java
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
// Copyright and License
|
||||||
|
|
||||||
|
import GraphicsApp.*;
|
||||||
|
import org.omg.CosNaming.*;
|
||||||
|
import org.omg.CORBA.*;
|
||||||
|
import org.omg.PortableServer.*;
|
||||||
|
import org.omg.PortableServer.POA;
|
||||||
|
|
||||||
|
// because we need GraphicalObject we have to do an implementation of it here.
|
||||||
|
// reversing the HelloServer.java here
|
||||||
|
class Graph extends GraphicalObjectPOA {
|
||||||
|
private boolean filled;
|
||||||
|
private String name;
|
||||||
|
private ORB orb;
|
||||||
|
|
||||||
|
public Graph(String name, boolean filled) {
|
||||||
|
this.name = name;
|
||||||
|
this.filled = filled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setORB(ORB orb_val) {
|
||||||
|
this.orb = orb_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw
|
||||||
|
public void draw() {
|
||||||
|
System.out.println("Drawing graph: " + name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// show info
|
||||||
|
public void showInfo() {
|
||||||
|
System.out.println("Graph Info -> Name: " + name + ", Filled: " + filled);
|
||||||
|
}
|
||||||
|
|
||||||
|
// getter for is filled
|
||||||
|
public boolean is_filled() {
|
||||||
|
return filled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setter for is filled
|
||||||
|
public void is_filled(boolean value) {
|
||||||
|
this.filled = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// name getter, not setting it.
|
||||||
|
public String name() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GraphicsClient
|
||||||
|
{
|
||||||
|
static Rectangle rect;
|
||||||
|
|
||||||
|
public static void main(String args[])
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
// create and initialize the ORB
|
||||||
|
ORB orb = ORB.init(args, null);
|
||||||
|
|
||||||
|
// get reference to rootpoa and activate the POAManager
|
||||||
|
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
|
||||||
|
rootpoa.the_POAManager().activate();
|
||||||
|
|
||||||
|
// reversing steps from HelloServer here as well.
|
||||||
|
// create servant and register it with the ORB
|
||||||
|
Graph graph = new Graph("Circle", true);
|
||||||
|
graph.setORB(orb);
|
||||||
|
|
||||||
|
// get object reference from the servant
|
||||||
|
org.omg.CORBA.Object ref = rootpoa.servant_to_reference(graph);
|
||||||
|
GraphicalObject object = GraphicalObjectHelper.narrow(ref);
|
||||||
|
|
||||||
|
|
||||||
|
// get the root naming context
|
||||||
|
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
|
||||||
|
|
||||||
|
// Use NamingContextExt instead of NamingContext. This is
|
||||||
|
// part of the Interoperable naming Service.
|
||||||
|
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
|
||||||
|
|
||||||
|
// resolve the Object Reference in Naming
|
||||||
|
String name = "Graphics";
|
||||||
|
rect = RectangleHelper.narrow(ncRef.resolve_str(name));
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("Obtained a handle on server object: " + rect);
|
||||||
|
rect.addObject(object);
|
||||||
|
rect.removeObjectAtPosition(0);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("ERROR : " + e) ;
|
||||||
|
e.printStackTrace(System.out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/GraphicsServer.class
Normal file
105
week1_TinsaeGhilay/Task2/GraphicsServer.java
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
// GraphicsServer.java
|
||||||
|
|
||||||
|
// I am not testing this server for fear of errors
|
||||||
|
// because if there are errors, I wont stop trying to debugg it untill tomorrow.
|
||||||
|
import GraphicsApp.*;
|
||||||
|
import org.omg.CosNaming.*;
|
||||||
|
import org.omg.CORBA.*;
|
||||||
|
import org.omg.PortableServer.*;
|
||||||
|
import org.omg.PortableServer.POA;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
// overriding the rectangle Class.
|
||||||
|
// copying from the Hello Project, I believe we extend the RectanglePOA class
|
||||||
|
class Rect extends RectanglePOA {
|
||||||
|
private ORB orb;
|
||||||
|
private GraphicalObject[] objects;
|
||||||
|
|
||||||
|
public Rect() {
|
||||||
|
this.objects = new GraphicalObject[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setORB(ORB orb_val) {
|
||||||
|
this.orb = orb_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// getter
|
||||||
|
public GraphicalObject[] objects() {
|
||||||
|
return this.objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setter
|
||||||
|
public void objects(GraphicalObject[] newObject) {
|
||||||
|
this.objects = newObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add objects
|
||||||
|
public void addObject(GraphicalObject newObject) {
|
||||||
|
List<GraphicalObject> temp = new ArrayList<>(Arrays.asList(this.objects));
|
||||||
|
temp.add(newObject);
|
||||||
|
this.objects = temp.toArray(new GraphicalObject[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// remove an object
|
||||||
|
public void removeObjectAtPosition(int index)
|
||||||
|
throws GraphicsApp.RectanglePackage.IndexOutOfBounds {
|
||||||
|
|
||||||
|
if (index < 0 || index >= this.objects.length) {
|
||||||
|
throw new GraphicsApp.RectanglePackage.IndexOutOfBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<GraphicalObject> temp = new ArrayList<>(Arrays.asList(this.objects));
|
||||||
|
temp.remove(index);
|
||||||
|
this.objects = temp.toArray(new GraphicalObject[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class GraphicsServer {
|
||||||
|
|
||||||
|
public static void main(String args[]) {
|
||||||
|
try{
|
||||||
|
// create and initialize the ORB
|
||||||
|
ORB orb = ORB.init(args, null);
|
||||||
|
|
||||||
|
// get reference to rootpoa and activate the POAManager
|
||||||
|
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
|
||||||
|
rootpoa.the_POAManager().activate();
|
||||||
|
|
||||||
|
// create servant and register it with the ORB
|
||||||
|
Rect rect = new Rect();
|
||||||
|
rect.setORB(orb);
|
||||||
|
|
||||||
|
// get object reference from the servant
|
||||||
|
org.omg.CORBA.Object ref = rootpoa.servant_to_reference(rect);
|
||||||
|
Rectangle href = RectangleHelper.narrow(ref);
|
||||||
|
|
||||||
|
// get the root naming context
|
||||||
|
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
|
||||||
|
|
||||||
|
// Use NamingContextExt which is part of the Interoperable
|
||||||
|
// Naming Service (INS) specification.
|
||||||
|
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
|
||||||
|
|
||||||
|
// bind the Object Reference in Naming
|
||||||
|
String name = "Graphics";
|
||||||
|
NameComponent path[] = ncRef.to_name( name );
|
||||||
|
ncRef.rebind(path, href);
|
||||||
|
|
||||||
|
System.out.println("GraphicsServer ready and waiting ...");
|
||||||
|
|
||||||
|
// wait for invocations from clients
|
||||||
|
orb.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception e) {
|
||||||
|
System.err.println("ERROR: " + e);
|
||||||
|
e.printStackTrace(System.out);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("GraphicsServer Exiting ...");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
week1_TinsaeGhilay/Task2/Rect.class
Normal file
1
week1_TinsaeGhilay/app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
37
week1_TinsaeGhilay/app/build.gradle
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdk 31
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.tgk.test"
|
||||||
|
minSdk 21
|
||||||
|
targetSdk 31
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
|
implementation 'com.google.android.material:material:1.4.0'
|
||||||
|
testImplementation 'junit:junit:4.+'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
}
|
||||||
0
week1_TinsaeGhilay/app/libs/.gitkeep
Normal file
21
week1_TinsaeGhilay/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.tgk.test;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
assertEquals("com.tgk.test", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
13
week1_TinsaeGhilay/app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.tgk.test">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.Test" />
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
BIN
week1_TinsaeGhilay/app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
BIN
week1_TinsaeGhilay/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 14 KiB |
16
week1_TinsaeGhilay/app/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.Test" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||